primitives icon indicating copy to clipboard operation
primitives copied to clipboard

Dropdown - viewport jumps to a random position with two-finger MacOs zoom in

Open misha-erm opened this issue 3 years ago • 4 comments

Bug report

Current Behavior

When you try to open dropdown menu after using MacOs pinch to zoom the viewport jumps to some random position

https://user-images.githubusercontent.com/8783498/178441963-27825d47-69e9-42fe-a8a2-2a4a40561e66.mov

Expected behavior

Viewport should stay at same position

Reproducible example

This reproduces even on documentation page https://www.radix-ui.com/docs/primitives/components/dropdown-menu#group CodeSandbox Template

Suggested solution

Additional context

Your environment

Software Name(s) Version
Radix Package(s)
React n/a
Browser Brave Version 1.40.107 Chromium: 103.0.5060.53 (Official Build) (x86_64)
Assistive tech
Node n/a
npm/yarn
Operating System

misha-erm avatar Jul 12 '22 08:07 misha-erm

Worth noting that this doesn't seem related to remove-scroll, a quick test showed the issue disappeared after removing PopperPrimitive.Content.

Not sure if related but I experienced a similar issue when using DropdownMenu inside an iframe.

andy-hook avatar Jul 12 '22 09:07 andy-hook

Also seems to be only an issue in Chrome (chromium based I guess), it's not an issue in Safari or Firefox.

benoitgrelard avatar Jul 19 '22 13:07 benoitgrelard

Seem to be having the same issue, are there any workarounds?

gino avatar Sep 11 '22 08:09 gino

Hi @gino, we haven't found one yet.

benoitgrelard avatar Sep 12 '22 09:09 benoitgrelard

Chiming in for collective async debugging. At the moment I have just some clues, not a real solution.


It seems that this issue is related to auto focus handling / tabIndex of the DropdownMenu.Content.

Setting <DropdownMenu.Content tabIndex={undefined}> seems to fix jumping screen when zoomed-in, however, that breaks keyboard navigation.

I was able to find a hacky workaround by:

  • managing open state myself
  • disabling auto-focus
  • focusing myself first element once dropdown opens

Looking at this example, I've made the following changes, and it somewhat works:

image

Anyway, this was just an intermediate results from my debugging. Maybe someone will find this useful if not for the hack then maybe for debugging.

lukaskl avatar Nov 15 '23 22:11 lukaskl