-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Autocompleter UI: Fix text color when hovering selected item #64294
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: -170 B (-0.01%) Total Size: 1.77 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.
Tests well for me and I can see the darker background color as described 👍
Oddly enough, I wasn't able to reproduce the original issue in trunk
. Perhaps I'm missing something.
Scratch that, I reproduced it, and confirmed this PR fixes it 👍
Finally, I think it would be a god idea to keep the selected class as some 3rd party plugins might be relying on it.
|
||
&.is-selected, | ||
&:not(:disabled,[aria-disabled="true"]):active { | ||
background: $components-color-accent; |
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.
I'm personally fine with that change 👍
Do we need a design approval on the darker hover of the selected item?
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.
@WordPress/gutenberg-design
I think it's fine for now, as it's consistent with the primary Button variant. However, I'm wondering if these styles should eventually be refactored/consolidated with DropdownMenu(v2). I think we can say they are the same UI pattern, but the selected item is styled differently:
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.
Hover color looks fine and is consistent with primary buttons. I'd agree the more we can consolidate, simplify, the better.
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.
Extracted to new issue: #64323
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.
LGTM 👍
Thanks @t-hamano 🚀
Related to #62480
What?
This PR fixes the text color when a selected item is hovered in Autocompleter UI.
Why?
In #62480, some CSS selector changes were made to improve button focus styles.
As a result, when an item is selected within the Autocompleter UI, i.e. when the background color is the primary color, the text color also changes to the primary color, making the text and icon invisible.
How?
I think the fundamental problem is that Autocompleter UI uses a unique selector called
is-selected
to indicate that an item is selected, which may conflict with the style of the Button component.We should be able to achieve a similar look without using this selector by setting the
variant
prop toprimary
. As a secondary benefit, it also allows for hover styling that is not currently applied (the background color becomes slightly darker).Testing Instructions
Additionally, to test our own autocomplete, install the following plugin and enter the character
~
:fruit-autocompleter.zip
Screenshots or screencast
Before
before.mp4
After
after.mp4