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): mobile drawer sidebar should use native modal dialog and backdrop #10706

Draft
wants to merge 2 commits 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-10706--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
/ 🔴 38 🟢 98 🟢 96 🟢 100 Report
/docs/installation 🔴 49 🟢 97 🟢 100 🟢 100 Report
/docs/category/getting-started 🟠 73 🟢 100 🟢 100 🟠 86 Report
/blog 🟠 63 🟢 96 🟢 100 🟠 86 Report
/blog/preparing-your-site-for-docusaurus-v3 🟠 62 🟢 92 🟢 100 🟢 100 Report
/blog/tags/release 🟠 64 🟢 96 🟢 100 🟠 86 Report
/blog/tags 🟠 72 🟢 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]

Name Link
🔨 Latest commit dbca10f
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/67c08b6f3d0b920008493ab9
😎 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
@slorber slorber added the pr: bug fix This PR fixes a bug in a past release. label Feb 27, 2025
@slorber slorber changed the title fix: use native modal dialog and use its backdrop fix(themle): use native modal dialog and use its backdrop Feb 27, 2025
@slorber slorber changed the title fix(themle): use native modal dialog and use its backdrop fix(theme): use native modal dialog and use its backdrop Feb 27, 2025
@slorber slorber changed the title fix(theme): use native modal dialog and use its backdrop fix(theme): mobile drawer sidebar should use native modal dialog and backdrop Feb 27, 2025
@slorber slorber added the Argos Add this label to run UI visual regression tests. See argos.yml GH action. label Feb 27, 2025
Copy link
Collaborator

@slorber slorber left a comment

Choose a reason for hiding this comment

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

I'd be happy to use <dialog>

But the current implementation doesn't really work like before 😅

CleanShot 2025-02-27 at 16 52 26

We need to preserve:

  • the styling
  • the drawer animated transition
  • the drawer closing on backdrop click

FYI I upgraded your branch to resolve conflicts without changing the behavior you implemented

@slorber slorber marked this pull request as draft February 27, 2025 16:01
Copy link

argos-ci bot commented Feb 27, 2025

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ✅ No changes detected - Feb 27, 2025, 4:05 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Argos Add this label to run UI visual regression tests. See argos.yml GH action. 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.

Modal dialog for menu on small viewports
3 participants