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: use native modal dialog and use its backdrop #10706

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hidde
Copy link
Contributor

@hidde hidde commented Nov 21, 2024

This uses the <dialog> element with showModal() method, so that we can leverage the browser's built-in ways to make this dialog modal, including keyboard handling (Esc), backdrop and focus trap.

Fixes the issue that it was possible to tab outside the dialog while it was open.

Rmoves the backdrop component, as the <dialog> element comes with a backdrop built-in, that is styled via CSS instead.

fixes #9457

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.
  • 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
/ 🔴 43 🟢 98 🟢 96 🟢 100 Report
/docs/installation 🟠 52 🟢 97 🟢 100 🟢 100 Report
/docs/category/getting-started 🟠 74 🟢 100 🟢 100 🟠 86 Report
/blog 🟠 61 🟢 96 🟢 100 🟠 86 Report
/blog/preparing-your-site-for-docusaurus-v3 🔴 48 🟢 92 🟢 100 🟢 100 Report
/blog/tags/release 🟠 65 🟢 96 🟢 100 🟠 86 Report
/blog/tags 🟠 76 🟢 100 🟢 100 🟠 86 Report

@hidde hidde force-pushed the fix/use-native-modal-dialog branch 3 times, most recently from b175464 to 36c07aa Compare November 21, 2024 11:56
Copy link

netlify bot commented Nov 21, 2024

[V2]

Built without sensitive environment variables

Name Link
🔨 Latest commit dbee3b0
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/673f4478fee3a600081928d8
😎 Deploy Preview https://deploy-preview-10706--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.

@hidde hidde force-pushed the fix/use-native-modal-dialog branch from 36c07aa to dd443d9 Compare November 21, 2024 12:01
@hidde
Copy link
Contributor Author

hidde commented Nov 21, 2024

@slorber : I'm not sure how to make that last autolintfix check run, please advise. Linted locally so autolintfix no longer needed

@hidde hidde force-pushed the fix/use-native-modal-dialog branch from dd443d9 to 0e38363 Compare November 21, 2024 14:23
This uses the `<dialog>` element with `showModal()` method,
so that we can leverage the browser's built-in ways to make
this dialog modal, including keyboard handling (Esc), backdrop
and focus trap.

Fixes the issue that it was possible to tab outside the dialog
while it was open.

This removes the backdrop component, as the `<dialog>` element
comes with a backdrop built-in, that is styled via CSS instead.
@hidde hidde force-pushed the fix/use-native-modal-dialog branch from 0e38363 to dbee3b0 Compare November 21, 2024 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Modal dialog for menu on small viewports
2 participants