-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 trigger misplaced depending on contextual layout #66958
Comments
I'm gonna remove the |
@michalczaplinski to my understanding the calculation of the button position is in the |
Oh, I didn't realize we calculated the button's position in JS. In that case, it IS related, sorry! We use the label for issues in the API itself, and its usage in Core blocks, so it makes sense to re-add it 🙂 . |
Thanks @michalczaplinski 👍🏻 |
@artemiomorales can you take a look? |
The logic for calculating the top-offset for the button is not robust, neither is necessary. Since, its absolutely positioned like @afercia mentioned. It can have a static top offset of 16px and that takes care of that. Though calculation is needed for the position from the right, as small images combined with large captions, skew the position of the button to be outside the image. |
Description
When an image opens the lightbox, a 'trigger' icon button is displayed on hover or focus on the front end. It appears this button absolute positioning
top
andright
value are calculated based on a series of factors but, in some cases, the actual positioning might end to be less than ideal.In the case of a normal Image block, the positioning works pretty well. However, when the Image block has a non-default layout due to being inside other containers, the positioning is really inconsistent and unpredictable. I would say it's not a great experience for users.
For example, in the screenshot below I'm using a Group block with its 'Grid' variation and I placed six images inside the grid. For some images, the placement of the button is less than ideal:
I don't have enough context to understand why the button position needs to be calculated. Given it's absolutely positioned based on the container figure element, wouldn't be better to drastically simplify and provide fixed top and right values?
Worth noting this misplacement may happen with any particular layoug, not only with the Group grid.
Noting that the misplacement of this button makes it even more difficult to be clearly visible. See related #55513
Step-by-step reproduction instructions
Grid
variant.Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.
The text was updated successfully, but these errors were encountered: