-
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
Anchor Tags In Gallery Images Are Covered by the Caption, Rendering Them Unclickable #14304
Comments
Should we wrap the caption inside the link cc @jasmussen @mapk ? |
Can we add |
I think that in HTML5 you can wrap an anchor around pretty much anything apart from other interactive elements. Wrapping block level elements like p inside an a is fine. |
Let's move in this direction. Are there any a11y issues that we should anticipate regarding this change? |
Related #13164 |
Hey! I saw the |
Before looking at the PR, I'd like to point out this problem already existed in the pre-Gutenberg era. However, it actually depended on the theme. For example, some of the bundled themes render the classic gallery captions in a way that doesn't overlay the image, see Twenty Seventeen: Instead, other bundled themes do overlay the caption onto the image e.g. Twenty Fourteen (same for Twenty Thirteen): So this problem is not new to Gutenberg and it's actually a design issue. Worth also noting the classic gallery in Twenty Nineteen doesn't overlay the captions: While the Gutenberg gallery does overlay captions: So on one hand, Gutenberg makes an opinionated choice and forces the captions to overlay the image. On the other hand, it doesn't provide a solution to the clickable area issue. I'm not sure forcing this rendering is the best option. To me, this should be handled by the theme and should be a theme author's choice. Will post accessibility related considerations on the PR. |
@ashwin-pc thanks for jumping into this! 👍 |
Good point @afercia. I wonder if the two different styles can be block style variations as mentioned in this comment. |
@ashwin-pc did some explorations in #11436 which was concluded with the following recommendation:
It was also noted by @mapk that this isn't a perfect solution but it's fine to fix the bug:
|
This approach seems to work with the new innerBlocks Gallery @jasmussen - PR here. |
@glendaviesnz there was some conversation about this issue in the Editor Weekly Bug Scrub, here is the direct link to the conversation. The consensus after reading through all the comments on this issue and the associated closed PRs, is that this is expected behavior and the issue should be closed. While I personally agree that WordPress Core likely should not have added the caption overlay to begin with since captions can also have links, this issue can be "resolved" with an additional block style or through specific theme styles. The block style approach would be an enhancement PR in my mind. So, what are your thoughts on closing this issue? |
@ndiego I agree with that conclusion. |
Describe the bug
The Gutenberg Gallery block renders each image with the caption overlaid over the image. This is done by absolute positioning of the figcaption element. Because the caption is not rendered inside the anchor tag which links each image to its source file, the area covered by the caption is not clickable. This is unexpected behaviour from a user perspective and provides a bad experience. Users expect the whole image/caption block to be clickable. Because the figcaption is rendered with a transparent backdrop, it is not clear to the user why the clickable area of the image seems to arbitrarily end half way down the image.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The whole image should be clickable, even if a caption is present. If there is a caption, the caption should be included in the anchor tag.
Screenshots
Desktop (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: