diff options
author | 2019-06-27 18:58:22 +0800 | |
---|---|---|
committer | 2019-06-27 18:58:22 +0800 | |
commit | 433be438fe5157da80a76e3f91cc990271099517 (patch) | |
tree | 716b7f99de7e0b57ef0645afa9c815343bbed577 /source/features/toggle-files-button.tsx | |
parent | 656fbfd5f9914a59f13ac474ce9ffac318704ad9 (diff) | |
download | refined-github-433be438fe5157da80a76e3f91cc990271099517.tar.gz refined-github-433be438fe5157da80a76e3f91cc990271099517.tar.zst refined-github-433be438fe5157da80a76e3f91cc990271099517.zip |
Fix file list jump caused by `toggle-files-button`
Fixes #2160
Without this change, the DOM would be:
```html
<include-fragment src="/sindresorhus/refined-github/tree-commit/3a55f541b11e78eff2484eb409f704e0eae9b32e"
class="commit-tease commit-loader">
<div class="blank loader-loading">
<img alt="" class="loader" src="https://github.githubassets.com/images/spinners/octocat-spinner-32-EAF2F5.gif"
width="16" height="16">
Fetching latest commit…
</div>
<div class="loader-error">
Cannot retrieve the latest commit at this time.
</div>
<button class="btn-octicon rgh-toggle-files" aria-label="Toggle files section" aria-expanded="true"><svg
aria-hidden="true" class="octicon octicon-chevron-down" width="10" height="16">
<path fill-rule="evenodd" d="M10 10l-1.5 1.5L5 7.75 1.5 11.5 0 10l5-5z"></path>
</svg></button>
</include-fragment>
```
Diffstat (limited to 'source/features/toggle-files-button.tsx')
-rw-r--r-- | source/features/toggle-files-button.tsx | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/source/features/toggle-files-button.tsx b/source/features/toggle-files-button.tsx index e1a04c3c..d36fca4a 100644 --- a/source/features/toggle-files-button.tsx +++ b/source/features/toggle-files-button.tsx @@ -7,7 +7,8 @@ import * as icons from '../libs/icons'; import observeEl from '../libs/simplified-element-observer'; function addButton(): void { - const filesHeader = select('.commit-tease'); + // `div` excludes `include-fragment`, which means the list is still loading. #2160 + const filesHeader = select('div.commit-tease'); if (!filesHeader || select.exists('.rgh-toggle-files')) { return; } |