scrollbar layout shift with dialog, dropdownmenu, etc #1100
-
For components that remove pointer events when opened, I am noticing a decent amount of layout shift as a result of the scrollbars toggling in and out. That is not something I am noticing on the radix docs site. I was wondering if you could provide any tips/tricks that you have learned to remove some of that layout shift? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 17 replies
-
Hey @rtkaaho, It is actually due to removing the scroll, rather than pointer events. If you look at our docs code, you'll see some examples of how we use this in places. Worth looking at also, the lib itself. I hope that helps! |
Beta Was this translation helpful? Give feedback.
-
I'm still seeing this issue after updating our select component to 1.0.0. Opening the select shifts our header, which is fixed |
Beta Was this translation helpful? Give feedback.
-
Putting modal={false} on the root dropdown element fixed it for me. |
Beta Was this translation helpful? Give feedback.
Hey @rtkaaho,
It is actually due to removing the scroll, rather than pointer events.
Under the hood, we use a library called
react-remove-scroll
which exposes some classes to use to mitigate this.If you look at our docs code, you'll see some examples of how we use this in places.
Worth looking at also, the lib itself.
It is itself built on top of a more generic one, where you can see the constants exported.
I hope that helps!