fix: set dataviews popover hover text color#80105
Conversation
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
|
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. |
|
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @Pranjal1423! In case you missed it, we'd love to have you join us in our Slack community. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
| ### Bug Fix | ||
|
|
||
| - DataViews: Stop the infinite-scroll list from jumping while pages load asynchronously. The scroll-anchor restoration no longer discards scrolling the user did during the load, and the footer's visibility no longer depends on the loading state, so it no longer mounts mid-load (resizing the scroll container). [#79546](https://github.com/WordPress/gutenberg/pull/79546) | ||
| - Fix Dataviews popover hover text color readability issue on WordPress 7.0. |
There was a problem hiding this comment.
Let's update the changelog entry properly, by adding the PR.
| &[data-active-item], | ||
| &:focus { | ||
| background-color: var(--wpds-color-background-interactive-brand-weak-active); | ||
| color: var(--wpds-color-foreground-content-neutral); |
There was a problem hiding this comment.
Yes, I think we should cover the description too.
A few related things I'm noticing:
- set the resting list-item color explicitly with
--wpds-color-foreground-interactive-neutral; - use the corresponding
--wpds-color-foreground-interactive-neutral-activetoken for hover, focus, and the active item; - give the secondary description the matching weak pair:
--wpds-color-foreground-interactive-neutral-weakat rest and--wpds-color-foreground-interactive-neutral-weak-activein the active states.
These options are interactive, so the foreground-interactive family describes their role more accurately than foreground-content. The description override is also necessary for this compatibility fix: WordPress 7.0 still applies a more-specific active-state selector with color: #fff directly to the description, so changing only the parent's color does not override it. With the default tokens, leaving the description at #707070 against the active #e6eaf4 background is only 4.11:1, below the 4.5:1 required for this small text by WCAG 2.2 SC 1.4.3.
Suggested use of the tokens
.dataviews-filters__search-widget-listitem {
color: var(--wpds-color-foreground-interactive-neutral);
&:hover,
&[data-active-item],
&:focus {
background-color: var(--wpds-color-background-interactive-brand-weak-active);
color: var(--wpds-color-foreground-interactive-neutral-active);
.dataviews-filters__search-widget-listitem-description {
color: var(--wpds-color-foreground-interactive-neutral-weak-active);
}
}
.dataviews-filters__search-widget-listitem-description {
color: var(--wpds-color-foreground-interactive-neutral-weak);
}
}
What?
Closes #80067
This PR explicitly sets the hover, focus, and active text color of the filter list items (
.dataviews-filters__search-widget-listitem) to the standard dark text color (var(--wpds-color-foreground-content-neutral)).Why?
In newer WordPress Core releases, the core stylesheet (
editor/style.css) contains a fallback style rule that sets the hover/active text color of Dataview list items to white (#fff) on a dark theme background.Gutenberg recently refactored the Dataviews dropdown styling to use a very light background color on hover (
var(--wpds-color-background-interactive-brand-weak-active)). However, because Gutenberg did not specify a text color for the hover state, it ended up inheriting the white text color rule from Core. This resulted in white text on a light background, making the dropdown items completely unreadable on hover.How?
By adding
color: var(--wpds-color-foreground-content-neutral);to the hover, focus, and active state selectors of.dataviews-filters__search-widget-listiteminsidepackages/dataviews/src/components/dataviews-filters/style.scss.Testing Instructions
Testing Instructions for Keyboard
SpaceorEnterto open the dropdown.DownandUparrow keys to navigate the list items.Screenshots
Before fix

After fix

Use of AI Tools
I used Chatgpt to help identify the missing color rule . I have personally made the change ,reviewed and verified all of it