Skip to content

Update dialog example page and examples#480

Open
rudigier wants to merge 5 commits into
mainfrom
feature/462-dialogue
Open

Update dialog example page and examples#480
rudigier wants to merge 5 commits into
mainfrom
feature/462-dialogue

Conversation

@rudigier
Copy link
Copy Markdown
Collaborator

@rudigier rudigier commented Apr 7, 2026

This PR updates the Dialog chapter to better reflect current accessibility guidance and native-first implementation practices.

It adds a native example, refines the modal and non-modal examples, and clarifies when to use native dialogs versus custom ARIA-based implementations.

What changed

  • updated the Dialog documentation and decision guidance
  • added a native modal dialog proof of concept
  • improved the modal and non-modal examples for accessibility and behavior consistency
  • refreshed supporting screenshots and example assets

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 7, 2026

Deploy Preview for accessibility-developer-guide ready!

Name Link
🔨 Latest commit 02437c2
🔍 Latest deploy log https://app.netlify.com/projects/accessibility-developer-guide/deploys/6a10c20be003c50008778899
😎 Deploy Preview https://deploy-preview-480--accessibility-developer-guide.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@rudigier rudigier changed the title Feature/462 dialogue Update dialog guidance and examples with native-first accessibility Apr 7, 2026
@rudigier rudigier changed the title Update dialog guidance and examples with native-first accessibility Update dialog example page and examples Apr 7, 2026
Comment thread pages/examples/widgets/dialog/README.md Outdated

| Aspect | Native `<dialog>` | Custom dialog (ARIA) |
| --- | --- | --- |
| Effort | Low | High |
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

here I have the same question as in #437 , is there a way to do row headers with markdown? Otherwise I can switch it to an html table.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Chnaged. thank you!

@rudigier rudigier requested a review from RA11y1 April 28, 2026 21:54
@backflip
Copy link
Copy Markdown
Collaborator

backflip commented May 7, 2026

Question: What is the reason for keeping any client-side JavaScript and not use the native dialog? I would be heavily in favor of deleting custom solutions.

@rudigier
Copy link
Copy Markdown
Collaborator Author

@backflip You mean using invoker commands instead? Good point but it's not for all browsers ready: https://caniuse.com/wf-invoker-commands

Copy link
Copy Markdown
Collaborator

@RA11y1 RA11y1 left a comment

Choose a reason for hiding this comment

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

The modal dialog functions well for NVDA on FF and Chrome. I want to check with @ReginaReusser on JAWS as well.

The non-modal dialog still captures the virtual cursor, NVDA has to switch to focus navigation using the tab key in order to leave the opened dialog.

Will resume at a later point when we were able to test with JAWS and the custom modal. Thx so far @rudigier !

<p>
<button data-adg-native-dialog="my-dialog" aria-haspopup="dialog">
Terms and conditions
<span class="adg-visually-hidden"> (dialog)</span>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<span class="adg-visually-hidden"> (dialog)</span>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The aria-haspopup="dialog" already leads to an announcement by the SR that a dialog will be opened. Therefore the visually hidden span is not needed.

As a side note (longer than I intended... ): visually hidden text is announced extra when using NVDA + FF. In this case I will first get the output "Button Terms and conditions" and when navigating forward one step with the arrow key I will get the second output "Button (dialog)". With around 16% of screen reader users using FF this might be worth taking a closer look.

Please read them carefully...
</p>
<p>
<button data-adg-dialog-confirm>Confirm<span class="adg-visually-hidden"> (close)</span></button>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Here as well, NVDA + FF will lead to two separate outputs for the visible and the visually hidden text when navigating with the virtual cursor. An alternative would be to use aria-label, this might have other downsides though (e.g. the aria-label text is not found by browser search, will have to check if and when that would be a problem).

@backflip
Copy link
Copy Markdown
Collaborator

@backflip You mean using invoker commands instead? Good point but it's not for all browsers ready: https://caniuse.com/wf-invoker-commands

@rudigier, we can still use JavaScript to open and close. But everything else can be completely removed unless I'm missing something. Example: https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement#examples

@backflip
Copy link
Copy Markdown
Collaborator

backflip commented May 21, 2026

@backflip You mean using invoker commands instead? Good point but it's not for all browsers ready: https://caniuse.com/wf-invoker-commands

@rudigier, we can still use JavaScript to open and close. But everything else can be completely removed unless I'm missing something. Example: https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement#examples

@rudigier, I think the most future-proof approach would be invoker commands with a polyfill. So no custom JavaScript for opening/closing, just the polyfill which can be reduced at some point in the future.

@rudigier
Copy link
Copy Markdown
Collaborator Author

rudigier commented May 22, 2026

@backflip
What I changed:

  • Reworked the dialog examples and docs around native , with Invoker Commands (command / commandfor) for open/close where the platform supports it, plus the invokers-polyfill script only for browsers that don’t yet.
  • Removed custom open/close JS from the modal and dialog+popover examples; the old script-based modal lives on as custom-modal-dialog (legacy) for reference only.
  • Non-modal still has a small script for .show() / toggle and aria-expanded, because Invoker Commands don’t cover .show() yet; close buttons use invokers.
  • Renamed native-dialog → dialog-popover, and expanded the main README with a native vs custom matrix and guidance for modal, non-modal, and popover variants.

@RA11y1 Removed some visible-hidden item, improved markup and added new examples to test :)

@rudigier rudigier requested a review from RA11y1 May 22, 2026 20:58
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.

3 participants