-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Dropdown: remove extra white space around toggle #56005
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
Conversation
|
Size Change: -4 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
jameskoster
left a comment
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, it works well. I didn't spot any issues in the Editor.
|
Let's revert for now, and think about a more satisfactory solution. In theory, switching to a flex-based layout is the correct solution for dealing with inline-block extra spacing. An even better solution would be to use the A couple of ideas that we would need to test:
All of these solutions could potentially cause some changes in the consumers of Another simpler alternative could be to add something like @andrewserong @jameskoster what are your thoughts? The more I think about it, the more I believe that the last option ( |
|
Thanks for reverting, and for the follow-up! Interesting problem. I think option 1 sounds potentially risky since we don't know what the children will be doing exactly, and similarly applying
|
* Dropdown: remove extra white space around toggle * CHANGELOG
|
I discovered the following problem, probably related to this PR and #56028. In the Site Editor sidebar, the button with the dropdown is shifted to the bottom. As @andrewserong said, the problem can be solved by applying |
|
Thanks for flagging that @t-hamano — interestingly enough, that button in the Navigation header goes back to displaying in the correct position if we remove the
Another option could be to set the wrapper for the I've opened a PR in #56233 to fix the positioning in case we want to go in that direction for that component 🙂 |




What?
A tweak to the
Dropdowncomponent to make sure that there isn't extra white space rendered around the toggle button.Why?
As flagged in #56002 (comment), sometimes there could be extra space around the dropdown toggle
How?
By changing
Dropdown'sdisplaystyle frominline-blocktoinline-flex. Using flexbox, in fact, automatically removes such white space around a wrapper's children.Testing Instructions
DropdownMenuexample, addtoggleProps: { size: 'small' }prop to the default exampleDropdownMenuwrapper element around the toggle (the one with classcomponents-dropdown components-dropdown-menu) is exactly 24x24 px (with the same changes applied totrunk, the wrapper would be 27px tall instead of 24)Additionally, smoke test usages of
DropdownandDropdownMenuacross the editor and make sure that the components look and behave as expected.