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

MenuPortal - horizontal position of menu is incorrect when browser is zoomed #3533

Closed
davidlucas opened this issue May 1, 2019 · 7 comments · Fixed by #5256
Closed

MenuPortal - horizontal position of menu is incorrect when browser is zoomed #3533

davidlucas opened this issue May 1, 2019 · 7 comments · Fixed by #5256
Labels
issue/bug-confirmed Issues about a bug that has been confirmed by a maintainer issue/reviewed Issue has recently been reviewed (mid-2020) menu-bug Addresses menu positioning, scrolling, or general interactions

Comments

@davidlucas
Copy link

A portaled menu when viewed on iOS Safari in a zoomed state on an iPhone/iPad has the wrong horizontal position.

This can be reproduced using the example on the website - https://react-select.com/advanced#portaling

@bladey bladey added the issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet label May 29, 2020
@bladey bladey added issue/bug-confirmed Issues about a bug that has been confirmed by a maintainer issue/reviewed Issue has recently been reviewed (mid-2020) and removed issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet labels Jun 17, 2020
@bladey
Copy link
Contributor

bladey commented Jun 17, 2020

IgFFKB

@AmrineA
Copy link

AmrineA commented Jul 29, 2020

This can also be replicated on Chrome using the portal example. If you open the portal drop down and then resize the window horizontally, you will see it move.

image

We've noticed this issue also when a site header resizes with scrolling. For example, the header of a site might be 200px until the user scrolls down and then it resizes to 100px. At that point, the menu items "detach" from the menu control. It appears the menu items will "reattach" when the mouse pointer hovers over the menu items.

@bladey bladey added issue/reviewed Issue has recently been reviewed (mid-2020) and removed issue/reviewed Issue has recently been reviewed (mid-2020) labels Aug 24, 2020
@andrzejwalk
Copy link

Any workaround for this?

@ebonow ebonow changed the title menuPortal - horizontal position of menu is incorrect when zoomed on iOS Safari MenuPortal - horizontal position of menu is incorrect when browser is zoomed Jan 17, 2021
@ebonow
Copy link
Collaborator

ebonow commented Jan 17, 2021

Confirmed that this behavior exists but not sure what if anything can be done. It appears that there is no standard in place to identify if a viewport has been "zoomed"
https://css-tricks.com/can-javascript-detect-the-browsers-zoom-level/

It should also be noted that the menu "snaps" back into its expected position when the menu/option is hovered. This leads me to believe that it may be related to some other behavior that prevents the menu from staying positioned as expected:
#4336
#4375
#4159

They all share similar behavior in that the scroll position is offset from what is expected but then snaps into place once the menu is hovered. I think it may be worth consolidating these into a single use-case to better identify the root.

In this particular use-case though, I'm not sure how to detect a change in zoom or if there is some other means of positioning that should be considered.

@ebonow
Copy link
Collaborator

ebonow commented Feb 1, 2021

Similar and perhaps related behavior
#3499

@ebonow ebonow added the menu-bug Addresses menu positioning, scrolling, or general interactions label Jun 10, 2021
@odusseys
Copy link

odusseys commented Jul 1, 2021

getting the same issue with no zoom (on desktop, chrome, mac)

@marius-m2
Copy link

Not sure if this helps but, one workaround you can try is to set a negative marginThreshold to offset the difference between the zoomed (height or width) and actual size.
In my case I had a fixed height of 540 and a zoom of 0.5 and it totally messed up the Popover. I've added a marginThreshold(https://v4-9-14.material-ui.com/api/popover/) of -500 to offset the zoom difference(you can obviously create it a bit more dynamic).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/bug-confirmed Issues about a bug that has been confirmed by a maintainer issue/reviewed Issue has recently been reviewed (mid-2020) menu-bug Addresses menu positioning, scrolling, or general interactions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants