pull-request-hotkeys - Restore feature - #9916
Conversation
Signed-off-by: Daniel Castrillon <[email protected]>
fregante
left a comment
There was a problem hiding this comment.
Thanks! I assume you tested this already
pull-request-hotkeys - Restore feature on current tabspull-request-hotkeys - Restore featur
pull-request-hotkeys - Restore featurpull-request-hotkeys - Restore feature
| const tabs = $$('a', tabnav); | ||
| const lastTab = tabs.length - 1; | ||
| const selectedIndex = tabs.findIndex(tab => tab.classList.contains('selected')); | ||
| const selectedIndex = tabs.findIndex(tab => tab.matches('.selected, [aria-current]')); |
There was a problem hiding this comment.
I don’t think this is working because g → and g ← don't behave correctly
Signed-off-by: Daniel Castrillon <[email protected]>
|
Yes sorry, the first navigation worked, but the tab elements persist across soft navigations, so the previous arrow shortcuts remained registered. I changed the arrow shortcuts to use the feature lifecycle, so they are removed and recalculated after each navigation. I tested multiple consecutive navigations in both directions, and they now work correctly. Thank you |
…tion" This reverts commit 99ea527.
| for (const [index, tab] of tabs.entries()) { | ||
| // Reset previous hotkeys because the DOM persists across soft navigations | ||
| // https://github.com/refined-github/refined-github/pull/9916#issuecomment-5157852083 | ||
| delete tab.dataset.hotkey; |
There was a problem hiding this comment.
I had to revert the listeners because the would pile up due to:
Thankfully the solution to the issue is much more low-tech: just remove the previous hotkeys first.
Closes #9907
Updates the pull request tab selectors to support GitHub's current navigation markup.
The feature now finds links within the scoped pull request navigation and recognizes the active tab through
aria-current, while preserving compatibility with the previousselectedclass.Test URLs
Screenshot
Not applicable; this change does not modify the interface.