Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this behavior alternatively go away if we remove the
content
css property from.mat-calendar-body-cell-preview
?@crisbeto do you remember why this rule has the
content
property?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing it's because I wanted to reuse the same styles with some
::before
and::after
selectors and I didn't want to split it out only due to thecontent
: https://github.com/angular/components/blob/master/src/material/datepicker/calendar-body.scss#L54.This is a little bit surprising to me, I assumed that
content
only works on pseudo elements.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting note from MDN on the
content
property:https://developer.mozilla.org/en-US/docs/Web/CSS/content#accessibility_concerns
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I tried removing the CSS content in #24095, but that did not fix the duplicate nav stop with VoiceOver
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird, I wouldn't have expected an empty
div
to be picked up by a screen reader. I don't mind going with thearia-hidden
here, but it would be good to understand why it happens.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To look for an explanation, narrowed it down to a minimally reproducing case. For some reason, the empty div must be absolutely positioned and the gridcell needs to have at least 2px of padding to reproduce.
Chrome has an unnecessary navigation stop with VoiceOver, but Firefox and Safari only have a single navigation stop.
Firefox a11y tree does not include a node for the empty div

but chrome does

The best explanation I can offer at this time is that we hit an edge case regarding empty a11y tree nodes being produced. I recommend going with this solution to add
aria-hidden="true"
.OS: macos 12.0.1 (21A559)
Chrome Version 96.0.4664.93 (Official Build) (x86_64)
Firefox 95.0 (64-bit)
Safari Version 15.1 (17612.2.9.1.20)