Skip to content

Conversation

web-padawan
Copy link
Member

@web-padawan web-padawan commented Aug 12, 2025

Description

Related to #122

Changed the date-picker logic according to the advice from #122

In the case of mobile devices, we would recommend ensuring that the when the date picker displays in a modal-like fashion, it be treated as a modal - providing an appropriate role="dialog", setting aria-modal="true", hiding the underlying page behind the semi-transparent overlay, and then setting the correct initial focus inside the dialog.

Type of change

  • Refactor

Note

Personally, I didn't spot any differences in terms of announcements with and without aria-modal:

VoiceOver

Screenshot 2025-08-12 at 14 43 38

NVDA

Screenshot 2025-08-12 at 14 29 59

JAWS

Screenshot 2025-08-12 at 14 40 26

@web-padawan web-padawan force-pushed the refactor/date-picker-aria-modal branch from 9fc22c9 to 17c0665 Compare August 12, 2025 11:49
firstUpdated() {
super.firstUpdated();

this.setAttribute('role', 'dialog');
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved this to the mixin - extra method feels unnecessary now when we removed Polymer version.

@web-padawan web-padawan force-pushed the refactor/date-picker-aria-modal branch from 17c0665 to f076b75 Compare August 12, 2025 11:52
if ((props.has('opened') || props.has('_noInput')) && this._overlayContent) {
if (this.opened && this._noInput) {
// Mark as modal on mobile if the input can not be accessed
this._overlayContent.setAttribute('aria-modal', 'true');
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not really able to verify if this is effective. We want other elements on the page to be removed from the accessibility tree.

In VoiceOver, bringing up the web rotor still lists heading and form controls in the background of the overlay. This does not happen with the previous aria-hidden logic. So aria-modal doesn't seem to do what it should here.

In NVDA, when the focus is in the overlay it is at least not possible to navigate to other parts of the page using shortcuts like h (next / previous heading) or f (next / previous form control). But that is also the case when not using aria-modal, so it seems that is probably how navigation works in general within dialogs in NVDA. There is a NVDA+F7 shortcut that is supposed to list other available elements on the page, but I have not figured out how to trigger that in my VM.

I do not have JAWS, so I wasn't able to test with that, maybe you could give it a try?

Copy link
Member Author

Choose a reason for hiding this comment

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

Tested with JAWS and it seems to be possible to escape the content using hotkeys like F / Shift + F for next / previous form control (although for some reason it only worked after I toggle virtual cursor mode off and back on).

Screenshot 2025-08-13 at 15 08 06 Screenshot 2025-08-13 at 15 09 53

Copy link

@sissbruecker sissbruecker marked this pull request as draft August 14, 2025 12:14
@sissbruecker
Copy link
Contributor

Converted to draft for now, as making this work properly will require additional changes and it's not high prio.

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