Skip to content
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

Lightbox: The right position of the close button is incorrect on Windows OS #56052

Closed
t-hamano opened this issue Nov 11, 2023 · 0 comments · Fixed by #56125
Closed

Lightbox: The right position of the close button is incorrect on Windows OS #56052

t-hamano opened this issue Nov 11, 2023 · 0 comments · Fixed by #56125
Assignees
Labels
[Block] Image Affects the Image Block Needs Testing Needs further testing to be confirmed. OS Issues Issues or PRs that are related to OS specific problems [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@t-hamano
Copy link
Contributor

Description

On Windows OS, when opening Lightbox with a document that has a scroll bar, the right position of the close button is incorrect.

close-button

The button position should be 16px from the right edge as defined by this CSS.

However, the width of the overlay, which is the reference for the position of the close button, is 100vw, so the width includes the scrollbar.

100vw

As a result, the close button's right position no longer takes into account the width of the scrollbar.

I tried CSS like below to solve this problem:

diff --git a/packages/block-library/src/image/style.scss b/packages/block-library/src/image/style.scss
index 2b8631fffe..9926cf0b4e 100644
--- a/packages/block-library/src/image/style.scss
+++ b/packages/block-library/src/image/style.scss
@@ -215,7 +215,7 @@
        left: 0;
        z-index: 100000;
        overflow: hidden;
-       width: 100vw;
+       right: 0;
        height: 100vh;
        box-sizing: border-box;
        visibility: hidden;

If you apply right: 0, the overlay width will fit inside the scrollbar. However, when the lightbox is closed, there is a slight unnatural shift, so a different approach is needed.

d0715020d00d72340f54b784deb01278.mp4

Step-by-step reproduction instructions

Note: This problem would only be reproducible on Windows OS where the browser scrollbars have a physical width.

  • Insert a Image Block and add an image.
  • Enable "Expand on click"
  • Show the post.
  • Click the image.
  • Focus on the button.
  • The focus outline should be almost adjacent to the browser scrollbar.

Screenshots, screen recording, code snippet

No response

Environment info

  • WordPress 6.4.1
  • Gutenberg latest trunk (Can be reproduced even if disabled)

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

@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended [Block] Image Affects the Image Block OS Issues Issues or PRs that are related to OS specific problems labels Nov 11, 2023
@jordesign jordesign added the Needs Testing Needs further testing to be confirmed. label Nov 12, 2023
@torounit torounit self-assigned this Nov 14, 2023
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Image Affects the Image Block Needs Testing Needs further testing to be confirmed. OS Issues Issues or PRs that are related to OS specific problems [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
3 participants