Skip to content
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

fix(theme): only render secondaryMenu if it should be shown #10705

Merged
merged 3 commits into from
Feb 27, 2025

Conversation

hidde
Copy link
Contributor

@hidde hidde commented Nov 21, 2024

fixes #10704

Issue was that with keyboard, you could reach the primary menu, while it was made invisible by CSS. By not rendering secondaryMenu based on the secondaryMenuShown logic, , we make sure it isn't accessible by keyboard while it is hidden.

Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
    • Note from author: I did not find existing tests for the behaviour and did not add new ones. We are dogfooding this change on nldesignsystem.nl (source).
  • If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

Motivation

Test Plan

Test links

Deploy preview: https://deploy-preview-_____--docusaurus-2.netlify.app/

Related issues/PRs

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Nov 21, 2024
Copy link

github-actions bot commented Nov 21, 2024

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO Report
/ 🟠 63 🟢 98 🟢 96 🟢 100 Report
/docs/installation 🔴 48 🟢 97 🟢 100 🟢 100 Report
/docs/category/getting-started 🟠 73 🟢 100 🟢 100 🟠 86 Report
/blog 🟠 68 🟢 96 🟢 100 🟠 86 Report
/blog/preparing-your-site-for-docusaurus-v3 🔴 45 🟢 92 🟢 100 🟢 100 Report
/blog/tags/release 🟠 62 🟢 96 🟢 100 🟠 86 Report
/blog/tags 🟠 74 🟢 100 🟢 100 🟠 86 Report

fixes facebook#10704

Issue was that with keyboard, you could reach the primary menu, while it was made invisible by CSS. By not rendering secondaryMenu based on the secondaryMenuShown logic, , we make sure it isn't accessible by keyboard while it is hidden.
Copy link

netlify bot commented Nov 21, 2024

[V2]

Name Link
🔨 Latest commit 38ea9ae
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/67c084d48554d000095d598f
😎 Deploy Preview https://deploy-preview-10705--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@slorber
Copy link
Collaborator

slorber commented Feb 27, 2025

Unfortunately your solution breaks the animated transition we have between drawer panes, notably when pressing the back button

CleanShot 2025-02-27 at 15 58 43

Instead I'm proposing to use HTML inert that looks like a better option for this use case: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inert

The inert attribute can also be added to elements that should be offscreen or hidden. An inert element, along with its descendants, gets removed from the tab order and accessibility tree.

There are probably many other places we should use this attribute now that it's widely supported.

@slorber slorber changed the title fix: only render secondaryMenu if it should be shown fix(theme): only render secondaryMenu if it should be shown Feb 27, 2025
@slorber slorber merged commit a6ef389 into facebook:main Feb 27, 2025
38 checks passed
@slorber slorber added the pr: bug fix This PR fixes a bug in a past release. label Feb 27, 2025
@hidde
Copy link
Contributor Author

hidde commented Feb 27, 2025 via email

@slorber
Copy link
Collaborator

slorber commented Feb 27, 2025

Thanks for checking and fixing!Note, that in your solution, only the menu is inerted, and not ‘everything but the dialog’ as the dialog with showModal would have done

Yes, but there's a separate PR for that you opened here :)

#10706

I'm open to merging it too if it doesn't break our existing UX

@hidde
Copy link
Contributor Author

hidde commented Feb 27, 2025

thank you, will give that a go in #10706

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: bug fix This PR fixes a bug in a past release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

On pages with secondary navigation, hamburger menu contains tab stops for primary navigation
3 participants