-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Polish Autocomplete popover #60131
Polish Autocomplete popover #60131
Conversation
Size Change: +13.8 kB (+1%) Total Size: 1.75 MB
ℹ️ View Unchanged
|
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. |
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 agree with changing the popover width and padding, but I'm a little hesitant about overriding the focus style or selected style.
This is because I think it will add an exception to the button component's focus style. When a button has a primary color as its background color, it often indicates that it is already selected, as can be seen in the list view. I think the outline should be displayed consistently when the button is focused.
Otherwise, the style will be inconsistent with other dropdown menus.
Example: Block transform popover
Personally, I think it's better to keep the focus style in autocomplete components as is.
Furthermore, I found that the current autocomplete mode is in Windows' high contrast mode and the focus outline is not displayed, so I can't know which block I'm trying to insert. I think this is an issue that needs to be resolved regardless of the autocomplete focus style.
This PR makes changes to the components package, so let me add the @WordPress/gutenberg-components team as reviewers. |
I'm targeting it with the .is-selected class. Curious as same logic follows for the Command Palette as well. |
Seems visually fine to me. I suspect the focus/selected feedback boils down to the fact that you can use both arrow keys, and tab, and click, to set focus. However, outside if rewriting that to be arrow-keys only, this PR already handles that, no? I.e. if you arrow down to an item, then click and drag on a button inside to set focus, and then tab through the items instead of arrowing, you get the focus style as additive to the select style, right? |
Seems consistent with DropdownMenu V2 👍 |
Yes, I accounted for that in this exploration. |
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.
To my best understanding, this handles both focus and selected correctly. I'll trust Rich to follow up if that's not the case.
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 see, since you guys seem to agree with this style, let's go ahead with this style 😅
One thing I noticed is that the text color changes when an option with isDisabled
set to true
is selected and you hover over it. This mouse action seems unnatural if the button is disabled. We probably need to target the disabled
attribute to override the style on mouseover.
The video below shows what it looks like after following this README and temporarily adding the own autocompleter.
2e5f62338fa410d648f47d210aae9df2.mp4
I think we need to update the changelog as well.
} | ||
|
||
&.is-selected, | ||
&:not(:disabled,[aria-disabled="true"]):active { |
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 think it is not necessary to include [aria-disabled="true"]
in this selector. Because the Button
component inside the Autocompleter never has this attribute.
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.
Seems sometimes it could have it?
I have prepared a plugin based on the README so that we can test the behavior when the button is disabled. After this is stalled, typing |
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.
No blockers from my end, but let's add a changelog before merging 👍
Similar to Aki's observations with the disabled case though, I noticed the hover styles are not consistent between Command Palette, List View, Autocomplete, and DropdownMenuV2, so maybe that is something to address in here or a separate PR.
What?
A quick exploration to match the autocomplete styling to that of List View and Command Palette. Also tweaks the size and padding a bit to generally map to existing popovers.
Testing Instructions
/
shortcut to add blocks.Screenshots or screencast
slash.mp4
The Command Palette: