-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Restore toggle-everything-with-alt feature
#2087
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restore toggle-everything-with-alt feature
#2087
Conversation
|
There are multiple of them on that page. It is the same as loading diffs for deleted files: https://github.com/sindresorhus/refined-github/pull/1524/files.
Happens to me on Chrome too. Not a bug, just main thread jank for clicking on 90 elements all at once. (Any solution?)
Missed that, added it in. |
It's worth investigating if it's the click or the selection being slow |
|
Should we space them out / delay them a bit? We can't cause multi-second freezes. In this case I'd probably click no more than 3 per second, also because it's gonna take longer than that to open + see them anyway, but only the "Load diff". You can probably implement this by using Additionally, perhaps, it could be limited to 10 files at a time, but this code might be a bit ugly and maybe not worth it. |
|
Also can you rename this to |
toggle-all-things-with-alt featuretoggle-everything-with-alt feature
|
Can you add the same mechanism here? https://github.com/sindresorhus/refined-github/pull/2073/files#diff-bfeb5de166cf585c43d9150166877a54R89 Except spaced every 3 and using requestAnimationFrame instead |
The handlers are delegated over to
I don't seem to follow you on this. If you are talking about #2087 (comment), then that's not possible, as the possible solution in #2073 mentioned would not work here. Spacing out callback to let the user scroll will cause the last scroll position to be invalidated and when the callback is eventually fired in rAF, the page scrolls to random positions for each callback. Having a jank is pretty reasonable IMHO (instead of handling scroll position changes for random file load jumps). |
|
There might have been some miscommunication. My comment only was referring to the |
|
I'm sorry, I think this feature can no longer be made of just 2 functions. In its first iteration last year, all toggles behaved similarly, now it seems that each one needs to behave differently because we keep fixing one side and breaking the other. Example in Chrome (you can see the menus flashing): In Firefox it's way worse as it takes longer and the scroll goes nuts. How about this: let's focus on one feature and get that one in first, for example #825 Ensure that it works in both browsers and without long stalls, we'll merge it. |
|
You can leave the name as |
|
I have good news for this:
Toggle can be simulated via: document.dispatchEvent(new KeyboardEvent('keydown', {code: 'KeyI', key: 'i'}))The |
|
Ping on this if you have time |
Sorry I couldn't reply on this, I've been away from keyboard lately because of a lot of distractions. I'll try to get back to handling things as fast as I can. |
|
I thought of closing this PR and opening a new one as it was getting a bit complex with way too many reviews, but I think I found solutions to the above issues, so left it as is.
Found the source of that bug, I was targeting the summary element deep within the hidden comment, which is also that dropdown.
That still has the issues mentioned above in #2087 (comment), the focus keeps shifting to the last file in the list, adding/removing is still the better way to go. |
|
Tested in Firefox.
This still freezes the browser for 1s+ to toggle all of those... but that's passable.
Seems to work correctly.
Does not work. The menu stays open as if the click was not registered at all. Previously reported in #2087 (comment)
Seems to work correctly. |
|
As said before, I was no a fan of all the I rewrote the feature trying to split it where it made sense and it's a bit shorter and readable. However I dropped the part that wasn't working (as per my previous comment) and given how complex it was, I'd rather see it replaced by something like anchorScroll(() => {
document.dispatchEvent(new KeyboardEvent('keydown', {code: 'KeyI', key: 'i'}))
}, clickedElement.closest('.js-file'));But that can come in a secondary PR. I'll test this further in both browser and I'll merge it soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's time
Thank you for the patience! This PR was open for a while :D



Closes #1729.
Implements and closes #825.
The feature now allows collapsing/expanding:
- Review comments per-file ("Show/Hide comments"): https://github.com/sindresorhus/refined-github/pull/1896/files.