Skip to content

Improve FloatingMenu CSS so it stays with its parent scroll #634

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

Open
Keavon opened this issue May 9, 2022 · 0 comments
Open

Improve FloatingMenu CSS so it stays with its parent scroll #634

Keavon opened this issue May 9, 2022 · 0 comments
Labels
Web Involves web programming (TypeScript, Svelte, CSS)

Comments

@Keavon
Copy link
Member

Keavon commented May 9, 2022

Before 8bc85bd, the CSS was set up to make floating menus employ a clever but fragile arrangement of position: flex, position: absolute, transform: translate(0), and other properties to make the elements stick to the bottom of their parent (without needing JS to position them) and also not get clipped by the overflow: hidden of their containing panel.

It was discovered that this arrangement did not hold up to the problem of scrolling the parent, such as the Properties panel containing widgets that spawn a floating menu (like ColorInput). 8bc85bd used JS to fix this, but doing so has the drawback that it isn't recomputed automatically by the CSS engine when things change. Window resizes, scrolling the parent, and other changes can cause the position of the spawner to change but the JS won't update the floating menu.

When placing floating menus within other floating menus (specifically, a DropdownInput inside a DialogModal in #629), it became necessary to further complicate the JS logic by disabling the positioning behavior. But if a DialogModal ever has scrollable content in the future, disabling it won't fix the original scrolling problem.

If possible, investigate a primarily CSS-based solution that's robust to the challenges described above. Then revert the complex JS that was introduced in that commit. This might help: https://css-tricks.com/popping-hidden-overflow/

Additionally, Safari behaves differently and currently clips the floating menu within a scrollable panel (but not non-scrollable ones, it seems... or at least it does for the Properties panel but not the Document panel). And in Safari, our distance-to-edge measuring code also seems to calculate the edges wrong since the primary/secondary color picker swatch goes too low and cuts it off the bottom of the app. So another solution is needed for the problem as a whole, but it also needs to account for fixing these issues on Safari.

@Keavon Keavon added Available Web Involves web programming (TypeScript, Svelte, CSS) labels May 9, 2022
@Keavon Keavon removed this from the Sprint 19 (upcoming) milestone Aug 13, 2022
@0HyperCube 0HyperCube moved this to Longer-Term in Task Board Mar 18, 2023
@Keavon Keavon removed the Available label May 31, 2023
@Keavon Keavon moved this to Longer-Term in Task Board May 31, 2023
@Keavon Keavon removed the P-Low label May 31, 2023
@Keavon Keavon removed the Cleanup label Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Web Involves web programming (TypeScript, Svelte, CSS)
Projects
Status: Longer-Term
Development

No branches or pull requests

1 participant