-
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 overlay the image with a transparent button #55097
Comments
One more reason why overlaying the transparent button over the image is less than ideal, it's that there's no guarantee the image will be actually rendered with the same size of the For example, Twenty Sixteen does it. It uses negative margins. As such, the transparent button may overlay only a part of the image, so clicking on the rest of the visible image doesn't do anything. Other themes may do crazy things with images and seems to me there's absolutely no guarantee the button will overlay the image correctly. In the screenshot below, I highlighted the transparent button with a red background and some opacity to better illustreate. - - Areas of the page that look empty but are actually clickable are very confusign and something we should really avoid.
I think the positioning of the button would be way simpler and more reliable if it as just a normal button overlaid in one of the image corners. Screenshot from Twenty Sixteen: |
Overall, I think this is something that should be prioritized for the incoming release. Cc @annezazu for consideraing some high priority. |
One more feature that will break with the lightbox is the image title attribute. Although title attributes aren't great as they're only available to some users, the editor gives the ability to add a title attribute to images. The title attribute is expected to show on hover in a native browseer 'tooltip'. Given the image is entirely overlaid with a transparent button, the actual hover happens on the button: browsers won't show any tooltip. To reproduce:
|
Pinging @jasmussen @SaxonF @jameskoster for feedback. |
Here I'll post previous feedback regarding the image and lightbox trigger to inform the current discussion:
|
@afercia How about if we put the button into the corner as you've suggested, but only make it available on focus and on hover? I understand that this approach introduces its own discoverability issues, but it also seems like a reasonable compromise between maintaining a minimal UI, keeping things accessible, and preserving browser behavior. Thanks for putting together this well-detailed issue and catching these scenarios by the way. We've put in a good amount of work to get the button to render correctly in many, but apparently not all, cases, and it appears the full button overlay is not the best approach. |
The discoverability problem is in my opinion pretty important. Without any visual hint that the image can be enlarged in a lightbox, how I'm supposed (as a user) to understand the presence of such a feature? Also, as said earlier, on touch devices there's no hover. Im not sure I understand what is the advantage with hiding the button. A 'minimal' UI is nice to hav ebut should never come at the expense of user experience. In design, form should follow function, not the other way around. |
I would echo Artemio's suggestion that a button visible on hover can be a solution. This works well for Substack. The zoom cursor on mouseover instead of the hand cursor provides sufficient context. |
This is, of course, my personal opinion, but I don't think discoverability is such a big deal for a feature like this. Other relevant platforms like Medium or Substack already have an "expand on click" for images, and many people are familiar with this feature. It's not as if we were launching a never-seen-before feature. For those who are not familiar, I think that the feature is simple enough to get discovered as they browse, and even for the small minority that will learn how to use it later, their UX won't get deeply impacted before they learn. |
Thanks all for the input! I’ve thought about this a bit more, and have some additional reflections.
@afercia WordPress allows users to configure links on images, and images are commonly clickable as links throughout the web, including on news websites, site logos, and advertisements. These images as links don’t contain any visual indication to show they’re interactable aside from being able to receive focus and the cursor showing as a pointer when they’re hovered over. I think a lightbox button then, appearing on hover and on focus, offers the same level of discoverability as in the above cases.
Thinking of non-technical users who are, in my experience, often overwhelmed by the number of elements on web pages, I think it also makes sense to hide the UI for something that’s not immediately necessary. There are many different kinds of use cases, but if we take news websites and blogs as an example, the primary function here is to deliver a seamless reading experience. I’d consider that having a small visual obstruction on every image would actually draw attention to itself and away from the content and an image's composition, in particular if we’re considering photography or artwork.
Here we start dealing with tradeoffs. Having a button always visible on mobile overlaid on the image, to the above point, especially one that's large enough to be easily interacted with, could distract from the composition of the image, and I believe having other always-visible UI just on mobile strictly for images would also distract from the experience of consuming the content.
@jasmussen Ok got it 👍 I’ve gone ahead and opened a PR. Happy to hear further thoughts on any of this! 😄 🙏 |
Description
When an image block is set to open the image in the lightbox, a transparent button entirely overlays the image.
This button is necessary to open the modal dialog. However, it entirely overlays the image. With the current implementation I see a couple problems that I'd consider pretty serious.
1
The browsers contextual menu that opens on right-click is different depending on the browser in use.
This surprised me. I would have expected to always get the same contextual menu. I have no idea whether this is a browser bug or a 'feature'. Regardless:
Regardless which browser is right and which one is wrong, the current implementation triggers a behavior that breaks am expected browsers feature. Also, the user experience is pretty confusing in at least two of the major browsers:
2
There is no visual indication at all that the image can be enlarged in a modal dialog
Visually, the image with the lightbox looks exactly like a normal image. There's no visual indication or any other hint to communicate that the image can be clicked and enlarged in the lightbox. The only subtle visual indications are only visible when hovering or tabbing:
zoom-in
.Seems to me both cases are insufficient indications.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
In the screenshots below, I altered the transparent button to better illustrate the issue:
macOS Chrome and Opera: right-click on the image shows the image contextual menu, as expected:
macOS Chrome and Opera: right-click on the button shows the image contextual menu, this is not expected:
macOS Firefox and Safari: right-click on the image shows the image contextual menu, as expected:
macOS Firefox and Safari: right-click on the button shows the button contextual menu, as expected:
Proposal
I'd think the simplest and most effective solution would be to just not entirely overlay the transparent button over the image. A visible button with an appropriate icon and labelling (preferably an icon + visible text for a11y reasons) would solve both issues:
I think a button in the top right is a pretty common pattern I've seen being used around on the web. Basically, a button placed in the red spot highlighted in the screenshot below:
Ideally, the buton should have visible text:
Enlarge {icon here}
In all cases, the button size should be at least 44 by 44 pixels.
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: