-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Box Control: Ensure Unlink tooltip position stays within the viewport #41176
Conversation
Size Change: +22 B (0%) Total Size: 1.24 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for tidying up these tooltips @andrewserong 👍
The issue was introduced when Popovers were refactored to use the floatingUI library (#40740).
✅ Tooltips appear correctly positioned for LTR
✅ Tooltips appear correctly positioned for RTL
❓ There are a lot of other buttons that have tooltips that are possibly displayed in a sidebar. These will also all need updating unless we can find a more generic way to solve this positioning problem. Perhaps via a better default position on the Button component?
Some examples in my limited testing so far include:
- Block editor
- Editor more / options menu
- FontSizePicker - Custom size toggle button
- ToolsPanel - Vertical ellipsis menu buttons
- InspectorControls sidebar's close button
- Site Editor
- Editor more / options menu
- Sidebar close and more buttons
- Color palette vertical ellipsis menus
- Create color palette add button
- Block list search field's clear button
I'm out of time today but can help look further into this tomorrow.
Thanks for testing @aaronrobertshaw!
That's a great point, it does look like it'd be worth looking to a more generalised solution for this, so that (somehow) if the button is close to the edge of the viewport, we make sure that the tooltip doesn't go off the side. So maybe there's a fix we can look into for the Tooltip component itself, potentially, too, if the Button component doesn't wind up being the right place? I'll do a bit more digging and 🤔 too! |
My naive guess (without exploring the code yet) is that we are now setting a default position on Tooltips whereas it was automatic placement previously which might have ensured rendering within the current viewport. |
I'll close out this PR now — I believe I've come up with a more thorough way to fix this directly in |
What?
Ensure that when you hover over the Unlink button in BoxControl components (e.g. Padding, Border, or Border Radius controls) that the Tooltip position does not go off the edge of the viewport.
Why?
We currently aren't setting the position on the wrapping
Tooltip
components, so the tooltip flows over the edge of the viewport. If we set the position tobottom left
, given that the Unlink button is as the right edge of the screen, this should ensure that the Tooltip is always within the viewport.How?
"bottom left"
to each of theTooltip
components used forLink sides
buttons in the design tools.Testing Instructions
Screenshots or screencast