-
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
Update: PanelColorGradientSettings to use dropdowns #37067
Merged
jorgefilipecosta
merged 3 commits into
trunk
from
update/panel-color-gradient-settings-to-use-dropdowns
Dec 14, 2021
+171
−68
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It looks like the addition of the Dropdown wrapper here adds an extra element around each item inside the itemgroup. So without the dropdown you have this markup:
With the extra wrapper, we have this:

In terms of tabbing that doesn't seem to be a problem due to the tabindex properties. But the extra wrapper does mean this rule now is causing trouble:
The rule is around the use of

border
for focus inside the itemgroup, making it transparent if it's the last child in an itemgroup. But because of the extra container, it's now adding transparent borders to every dropdown container which makes them all 1px taller. Compare this context:... with that of global styles:

My instinct tells me the solution is to refactor how focus works inside the itemgroup, to not rely on those advanced selectors, but perhaps instead just use a pseudo element. That would also let us avoid the use of transparent borders, which I think are problematic anyway due to them being made opaque in high contrast modes.
But before I explore a fix for this in a separate PR, I wonder: @ciampo do you think my instinct above makes sense, or would there be a different or better way to fix this?
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.
@jorgefilipecosta it looks like the
ItemGroup
component is designed to have a very specific structure ofItemGroup > Item
(likeul > li
) and that the border styles are designed for the DOM structure to be pretty specific. As noted above the addition of theDropdown
is causing a few small issues since the structure becomesItemGroup > Dropdown > Item
, making the border rules target the wrong element.It's not problematic enough to block this PR, I think, but it's also not ideal.
Just to see if it was possible, I tried to see if it would work to move the
Dropdown
inside theItem
. Like so:It doesn't totally work, it replaces the
UnstyledButton
with theDropdown
. But is there a way we could make it work? Any thoughts?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.
@jasmussen analysis is correct.
I've tried playing around with the markup a little, but I couldn't find any good solution — mainly trying to change the outline to something like:
But that would mean that we'd need to apply most of the styles of
<Item>
to<Button>
to achieve the same look&feel (and even then there could be some glitches)I think that the best solution for now is to keep things as they are, and look into improving how
ItemGroup
andItem
are styled directly at the source level.