Skip to content

fix: allow browser back/forward navigation in Tabs (Cmd+Left/Right on Mac, Alt+Left/Right on Windows)#10315

Open
UsmanKhursheed06 wants to merge 2 commits into
adobe:mainfrom
UsmanKhursheed06:fix/tabs-cmd-arrow-navigation
Open

fix: allow browser back/forward navigation in Tabs (Cmd+Left/Right on Mac, Alt+Left/Right on Windows)#10315
UsmanKhursheed06 wants to merge 2 commits into
adobe:mainfrom
UsmanKhursheed06:fix/tabs-cmd-arrow-navigation

Conversation

@UsmanKhursheed06

Copy link
Copy Markdown

Summary

When users press Cmd+Left/Right (Mac) or Alt+Left/Right (Windows/Linux) to navigate browser history, the Tabs component was capturing these keystrokes and switching tabs instead of letting the browser handle back/forward navigation.

Changes

  • Added hook in with explicit shortcuts for browser navigation key combinations
  • Shortcuts return to allow events to bubble to the browser
  • Preserves normal tab navigation with unmodified arrow keys

Testing

Added comprehensive test in verifying:

  • Meta+ArrowLeft/Right (Mac) does NOT switch tabs
  • Alt+ArrowLeft/Right (Windows/Linux) does NOT switch tabs
  • Regular arrow keys still work for tab navigation

All existing tests pass (50/50).

… Mac, Alt+Left/Right on Windows)

When users press Cmd+Left/Right (Mac) or Alt+Left/Right (Windows/Linux) to navigate
browser history, the Tabs component was capturing these keystrokes and switching tabs
instead of letting the browser handle back/forward navigation.

Added keyboard shortcut handlers in useTabList that explicitly allow propagation for
these browser navigation key combinations, while preserving normal tab navigation
with unmodified arrow keys.

Fixes adobe#9648
await menu.close();
});

it('allows browser back/forward navigation (Meta+ArrowLeft/Right on Mac, Alt+ArrowLeft/Right on Windows)', async () => {

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.

This test is passing without your change. It was likely fixed since the last release with our new useKeyboard apis and will go out in our next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants