Skip to content

pull-request-hotkeys - Restore feature - #9916

Merged
fregante merged 4 commits into
refined-github:mainfrom
danielcadev:fix-pull-request-hotkeys
Aug 3, 2026
Merged

pull-request-hotkeys - Restore feature#9916
fregante merged 4 commits into
refined-github:mainfrom
danielcadev:fix-pull-request-hotkeys

Conversation

@danielcadev

Copy link
Copy Markdown
Contributor

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 previous selected class.

Test URLs

Screenshot

Not applicable; this change does not modify the interface.

@github-actions github-actions Bot added the bug label Jul 31, 2026
@danielcadev
danielcadev marked this pull request as ready for review July 31, 2026 18:54

@fregante fregante left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I assume you tested this already

@fregante fregante changed the title pull-request-hotkeys - Restore feature on current tabs pull-request-hotkeys - Restore featur Aug 2, 2026
@fregante fregante changed the title pull-request-hotkeys - Restore featur pull-request-hotkeys - Restore feature Aug 2, 2026
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]'));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think this is working because g → and g ← don't behave correctly

@danielcadev

Copy link
Copy Markdown
Contributor Author

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

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;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@fregante
fregante merged commit 458cd29 into refined-github:main Aug 3, 2026
13 checks passed
@danielcadev
danielcadev deleted the fix-pull-request-hotkeys branch August 3, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

pull-request-hotkeys does not work for me

2 participants