Skip to content

feat(GCOM-1616): Keep keyboard focus inside the open navigation menu - #2703

Open
DivaniNL wants to merge 1 commit into
canaryfrom
focus-trap-fix
Open

DivaniNL wants to merge 1 commit into
canaryfrom
focus-trap-fix

Conversation

@DivaniNL

@DivaniNL DivaniNL commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Written by Claude Code:

With the navigation menu open, Tab moves focus out of the menu into the page behind it. In a submenu, Tab also goes to the items of the parent columns, which are off screen on mobile.

  • NavigationItem: an item is a tab stop only when its parentPath is the same as the selection. The includes check also matched the parent columns.
  • NavigationOverlay: Tab on the last focusable element of the pane moves focus to the first one, and Shift+Tab on the first one moves focus to the last one.
  • OverlayBase: overlayPaneProps accepts the props of a motion div, so the pane can get onKeyDown.

Test plan: on the magento-graphcms preview, click "Shop" in the header and press Tab and Shift+Tab. Focus goes through Back, Close and the items of the open column, and stays in the menu. Open a submenu with Enter and do the same: only the items of that submenu are tab stops.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
graphcommerce-246 Ready Ready Preview Dec 4, 2026 2:31pm UTC
graphcommerce-247 Ready Ready Preview Dec 4, 2026 2:31pm UTC
graphcommerce-hygraph-dynamic-rows-ui Ready Ready Preview Dec 4, 2026 2:31pm UTC
graphcommerce-open-source Ready Ready Preview Dec 4, 2026 2:31pm UTC
graphcommerce-storyblok Ready Ready Preview Dec 4, 2026 2:31pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b564953

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 87 packages
Name Type
@graphcommerce/magento-graphcms Patch
@graphcommerce/magento-open-source Patch
@graphcommerce/magento-storyblok Patch
@graphcommerce/docs Patch
@graphcommerce/browserslist-config-pwa Patch
@graphcommerce/changeset-changelog Patch
@graphcommerce/eslint-config-pwa Patch
@graphcommerce/graphql-codegen-markdown-docs Patch
@graphcommerce/graphql-codegen-near-operation-file Patch
@graphcommerce/graphql-codegen-relay-optimizer-plugin Patch
@graphcommerce/misc Patch
@graphcommerce/next-config Patch
@graphcommerce/prettier-config-pwa Patch
@graphcommerce/typescript-config-pwa Patch
@graphcommerce/address-autocomplete Patch
@graphcommerce/address-fields-nl Patch
@graphcommerce/algolia-categories Patch
@graphcommerce/algolia-insights Patch
@graphcommerce/algolia-personalization Patch
@graphcommerce/algolia-products Patch
@graphcommerce/algolia-recommend Patch
@graphcommerce/algolia-search Patch
@graphcommerce/cli Patch
@graphcommerce/demo-magento-graphcommerce Patch
@graphcommerce/ecommerce-ui Patch
@graphcommerce/framer-next-pages Patch
@graphcommerce/framer-scroller Patch
@graphcommerce/framer-utils Patch
@graphcommerce/google-datalayer Patch
@graphcommerce/google-playstore Patch
@graphcommerce/googleanalytics Patch
@graphcommerce/googlerecaptcha Patch
@graphcommerce/googletagmanager Patch
@graphcommerce/graphcms-ui Patch
@graphcommerce/graphql-mesh Patch
@graphcommerce/graphql Patch
@graphcommerce/hygraph-cli Patch
@graphcommerce/hygraph-dynamic-rows-ui Patch
@graphcommerce/hygraph-dynamic-rows Patch
@graphcommerce/hygraph-ui Patch
@graphcommerce/image Patch
@graphcommerce/lingui-next Patch
@graphcommerce/magento-cart-checkout Patch
@graphcommerce/magento-cart-coupon Patch
@graphcommerce/magento-cart-email Patch
@graphcommerce/magento-cart-items Patch
@graphcommerce/magento-cart-payment-method Patch
@graphcommerce/magento-cart-pickup Patch
@graphcommerce/magento-cart-shipping-address Patch
@graphcommerce/magento-cart-shipping-method Patch
@graphcommerce/magento-cart Patch
@graphcommerce/magento-category Patch
@graphcommerce/magento-cms Patch
@graphcommerce/magento-compare Patch
@graphcommerce/magento-customer Patch
@graphcommerce/magento-graphql-rest Patch
@graphcommerce/magento-graphql Patch
@graphcommerce/magento-newsletter Patch
@graphcommerce/magento-payment-adyen Patch
@graphcommerce/magento-payment-afterpay Patch
@graphcommerce/magento-payment-braintree Patch
@graphcommerce/magento-payment-included Patch
@graphcommerce/magento-payment-klarna Patch
@graphcommerce/magento-payment-multisafepay Patch
@graphcommerce/magento-payment-paypal Patch
@graphcommerce/magento-payment-tokens Patch
@graphcommerce/magento-product-bundle Patch
@graphcommerce/magento-product-configurable Patch
@graphcommerce/magento-product-downloadable Patch
@graphcommerce/magento-product-grouped Patch
@graphcommerce/magento-product-simple Patch
@graphcommerce/magento-product-virtual Patch
@graphcommerce/magento-product Patch
@graphcommerce/magento-recently-viewed-products Patch
@graphcommerce/magento-review Patch
@graphcommerce/magento-search-overlay Patch
@graphcommerce/magento-search Patch
@graphcommerce/magento-store Patch
@graphcommerce/magento-wishlist Patch
@graphcommerce/mollie-magento-payment Patch
@graphcommerce/next-ui Patch
@graphcommerce/react-hook-form Patch
@graphcommerce/service-worker Patch
@graphcommerce/storyblok-ui Patch
@graphcommerce/framer-next-pages-example Patch
@graphcommerce/framer-scroller-example Patch
@graphcommerce/image-example Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@DivaniNL DivaniNL changed the title Keep keyboard focus inside the open navigation menu feat(GCOM-1616): Keep keyboard focus inside the open navigation menu Nov 27, 2026
@bramvanderholst

Copy link
Copy Markdown
Contributor

Kunnen we dit niet volledig afvangen met alleen inert op de achterliggende pagina te zetten?

@DivaniNL

DivaniNL commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

Yep, sounds good. Dit werkt ook lekker.

Enkel de regel in NavigationItem moet wel blijven. Anders moet je eerst door verborgen navitems tabben in de mobiele weergave (best wel een edge cast want dan moet je je scherm op desktop klein maken) maar goed om af te vangen i guess. Als je dit ook weg wil hebben let me know


const tabIndex = useMotionValueValue(selection, (s) =>
s !== false && s.join(',').includes(parentPath) ? undefined : -1,
s !== false && s.join(',') === parentPath ? undefined : -1,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Dit sloopt desktop. Graag weghalen. Op mobiel gaat toch niemand tabben.

Comment on lines +17 to +19
const selection = useNavigationSelection()
const router = useRouter()
const navigationOpen = useMotionValueValue(selection, (s) => s !== false)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Kun je niet gewoon useNavigationSelection() op de plek waar je inert nodig hebt? Dan hoef je het niet zelf bij te houden en door te geven.

@bramvanderholst

Copy link
Copy Markdown
Contributor

Eindresultaat graag even force pushen. Dan houden we de history ook een beetje schoon.

This branch was successfully deployed

5 active deployments
Preview – graphcommerce-247 — b5649534 Deployed Dec 4, 2026 by vercel[bot]
Preview – graphcommerce-246 — b5649534 Deployed Dec 4, 2026 by vercel[bot]
Preview – graphcommerce-storyblok — b5649534 Deployed Dec 4, 2026 by vercel[bot]
Preview – graphcommerce-open-source — b5649534 Deployed Dec 4, 2026 by vercel[bot]
Preview – graphcommerce-hygraph-dynamic-rows-ui — b5649534 Deployed Dec 4, 2026 by vercel[bot]
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