-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Image block lightbox: do not hide the figcaption with display none #55088
Comments
It'd be good to get another perspective on this one. Could @joedolson and/or @alexstine could take a look? Perhaps it might be better in this case to not show the caption in the lightbox so as to prevent redundant information for folks who use screen readers. In any case, I've tested adding the If we do want to make the caption available in the lightbox, I think adding the I'll also note that neither VoiceOver on Mac nor the NVDA browser extension announces the caption at all in Chrome. |
I'm not sure I fully understand. The caption is just text, it's not expected to be able to tab to it. To navigate content, arrows navigation is the right way.
You should never test VoiceOver with Chrome. VoiceOver is expected to work best with Safari.
The double image is a problem. Instead of overlaying the two images, one of them should be hidden and only revealed when necessary (whilehiding the other one). |
One thing I'll observe is that there shouldn't be any legal case for an image with an empty alt and a caption. If an image merits a caption, then it should also merit a description. If the caption is being used to describe the image, then that's misusing the caption. If the modal shouldn't show the caption visibly, then the simplest resolution is to add the related figcaption text into the alt attribute if the alt attribute is empty. If the figcaption is going to be made available to a screen reader while the lightbox is open, I think it should also be visible. Also agree that if an image is hidden, then it should be completely hidden, not just visually hidden. |
Ok got it, I've created an issue for this. |
This approach sounds good to me, although it seems this solution seems somewhat at odds with #43059, which uses We could try taking the What if we were to use Pinging @carolinan for feedback. CC @afercia |
I think that would be a little too much opinionated. On one hand, the editor aims to give users full power on building their site and posts exactly how they want them to look. On the other hand, the Lighbox look and feel is opinionated and there are no settings to change its appearance. The Navigation component, at least, has a setting to change icons to text. The lighbox should have settings to let users decide whether they want the caption to be visible in the dialog or not. |
@joedolson should we revise any of the work done a few years ago in core with the image caption? See |
Description
Noticed while working on #55010
When an image has an empty alt attribute and the wrapping figure element does have a figcaption element, the actual image description is determined, both visually and semantically, by the figcaption content.
Screen readers announce the figcaption even when the image is marked as 'decorative' by the means ot an empty
alt=""
.Screenshot when testing with Safari and VoiceOver:
When the lightbox is enabled and its modal dialog opens, the
figcaption
element is hidden via CSS display: none. As such, important information related to the image is not available for all users:In this case, screen readers don't have anything meaningful to announce, they will only announce the
figure
element. Screenshot:This is clearly not the best experience for screen reader users. They will be informed that a modal dialog has opened. They will not have any clue what the modal dialog content is other than a figure element.
I'd argue that also visually the figcaption represents important information that should always be visible, also in the modal dialog.
At the very least, the figcaption element should not be hidden with display: none. Instead, it should be visually hidden via the screen-reader-text class or by other means to keep it perceivable by assistive technology.
Step-by-step reproduction instructions
figure
element with no other information related to the imageScreenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: