Repository navigation
DataViews: Use the focus ring mixin for all focus rings - #87691
Conversation
🤖 PR meta 🤖🎉 PropsIf 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. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: +1.72 kB (+0.02%) Total Size: 8.73 MB 📦 View Changed
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
|
|
I had the same reaction as @jasmussen. It feels like something we can potentially follow-up to unpack. Worth noting that the selection ring will become neutral colored once #87452 lands. I don't know if that helps or hinders. My instinct is that an overlay treatment might work better than an outline for selection. But we had something like that in the past and obviously changed it. I'd need to dig up the reason why. This all points to a follow-up I think. |
|
I mentioned this in the PR description: Note In this PR, a selected and focused grid item shows a double brand-colored ring. This will be fixed by #87452, which changes the selected ring to be neutral-colored. Would you be open to having the combined effect of #87452 and this PR (ie still double ring, but two different colors) as an intermediate step, as a better alternative for selected is explored? |
11d0535 to
fdbdbdd
Compare
|
#87452 merged, here's what a selected and focused grid item looks like: Is it good enough for this iteration, or do you suggest other changes? |
|
I would connect the double ring effect with the design idea shared in #82113 that addresses the grid item selected where media and other fields are visible/hidden. |
Move the focus rings that still use --wp-admin-border-width-focus or a hard-coded 2px width to the outset-ring__focus() mixin or the --wpds-border-width-focus token. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Draw the picker grid, picker table and grid media rings with the outset-ring__focus() mixin, inside the item, so that the scroll container does not clip them. Remove the default outline that doubled the grid media ring, and the focus rule for the picker grid media, which never receives focus. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…yles Draw the grid preview ring outside the preview, so it stays distinct from the selection ring. Clear the WordPress common.css box-shadow on focused title links. Move the picker table ring below the line above the row, so the sticky end cells no longer cover it. Remove the panel trigger's own outline, which the Button focus ring already overrides. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Draw the grid preview and picker grid card focus rings inside the item, past the selection ring, so that they stay distinct from it and the scroll container can't clip them. Clear the WordPress common.css box-shadow on focused preview and activity title links. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Draw the picker grid card ring outside the card, clear of its content, and reserve room above the first row so the scroll container doesn't clip it. Draw the grid preview ring on its overlay, above positioned preview content. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Draw the grid preview ring outside the preview, where its content can't cover it, and the table thumbnail ring with the focus ring mixin. Leave room above the first row of the grid layouts and add scroll margins, so neither the scroll container nor keyboard scrolling clips the rings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Let the grid and list title fields show the focus ring of a link they contain, and keep focused grid items, focus rings included, below the sticky bulk toolbar. Describe the visible focus ring changes in the changelog. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Let the grid and list title fields show the focus ring of a button as well as a link, and clear the WordPress common.css shadow on activity title links for any focus, not only keyboard focus. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only the links and link buttons that DataViews truncates stay within the title field, so show overflow only while one of them has focus. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…verflow Opening the title field's overflow let content that doesn't truncate itself escape it. Draw the ring of a link in a title field with no offset instead, so it fits in the room the layouts leave above and below it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Give the grid, list and activity item titles room inside their clipping box for the focus rings of links and buttons in them, with padding and a matching negative margin that keep their layout. Document pairing a custom background with a ThemeProvider, so focus rings keep contrast. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Let pointer events pass through a list title that holds a link or button, except on those, so its room for focus rings doesn't take clicks from the row. Recommend a ThemeProvider background over the CSS property for custom DataViews backgrounds, and checking the focus ring otherwise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Passing pointer events through list titles cost text selection and other controls in them, so keep the base behavior and note what the room for focus rings adds to it. Give the sticky infinite-scroll view actions the DataViews background instead of white, so themed focus rings keep their contrast there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… room Paint the DataViews background over an opaque surface in the sticky infinite-scroll view actions, so items don't show through with a translucent background. Picker cards are listbox options, which can't hold links accessibly, so drop the room for title focus rings there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…room Give the sticky infinite-scroll view actions the design system surface color: opaque like the white it replaces, and themed by a ThemeProvider together with the icons in it. Only make room for focus rings in item titles that hold a link or button, so text-only titles keep their edge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#87452 already gave the sticky view actions of an infinite-scroll view the --wp-dataviews-color-background color, falling back to the surface color. Keep that, so a custom background still applies, and drop the changelog entry this change no longer needs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#87452 moved the selection ring of grid and picker grid previews outside the preview, where the focus ring is too. On a selected and focused item, draw the focus ring one focus width past the selection ring, so both stay visible: - Grid: the preview has one outline for both rings, so the outline draws the focus ring and a shadow draws the selection ring, over a gap filled with the DataViews background. - Picker grid: the card's focus ring moves out past the preview's selection ring, and the card gets the preview's corner radius so the ring follows it. Grow the room above the first row, and the scroll margins, to fit both rings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the selection ring around the grid and picker grid previews with a neutral background that spans the whole card. It reaches past the card, so the content keeps its place, and the checkbox still marks the selection. The focus ring of a selected preview no longer needs to clear a selection ring, and the picker grid draws it past the background. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fdbdbdd to
dbe9fa4
Compare
|
I changed the selection treatment following the feedback above. Selected
Arrowing between grid cards now draws the card's ring outside the gray background too, instead of inside the card next to the browser's default ring: Discarded alternative: background and borderThe same background with a 1px neutral border (
|
The ring of a grid card focused with the arrow keys sat inside the card, within the selection background, next to the browser's default ring. Draw it as the card's outline, outside the card and one focus width past the selection background when the card is selected, and leave room for it above the first row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I think I'd be inclined to keep the double-ring because it's a bit closer to what's on trunk, and explore an alternative design separately. |
Revert the neutral selection background and the card focus ring change that depended on it. Selected grid and picker grid cards show the dark ring around the preview again, with the focus ring drawn past it, which stays closer to trunk. An alternative selection design can be explored separately. This reverts commits f0c886d and dbe9fa4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A grid card focused with the arrow keys showed the browser's default ring plus ours, drawn inside the card. Draw a single ring as the card's outline, outside the card, and one focus width past the selection ring of the preview when the card is selected. Give the card the same scroll margin as the preview, so the rings stay in view. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Switched back to the double-ring for now. At this point,should we merge this PR and iterate if/as needed? |
simison
left a comment
There was a problem hiding this comment.
Might make sense to wait for final design approval since we're so close to package release, but meanwhile ✅
jameskoster
left a comment
There was a problem hiding this comment.
Pretty much all the other states are an improvement so I'm happy to approve. Let's follow-up on the select state for grid items though.
|
Moved over to #87815, where I'm getting the conversation started with a few potential ideas |











What?
Follow-up to #87662.
Moves the DataViews focus rings to the
outset-ring__focus()mixin, and fixes the ones that got clipped or doubled up along the way.Why?
Some rings still used
--wp-admin-border-width-focus, a hard-coded2px, an insetbox-shadow, or the oldlink-reset()mixin, which draws in the admin theme color. A few were also clipped by the scroll container or hard to tell apart from the selection ring.How?
Every ring DataViews draws now uses the mixin. Rings against a scroll edge in single-column layouts (list item, picker table row, picker activity item) sit inside the item. The rest sit outside.
What you'll notice:
2pxnow follow the token, so they're 1.5px like every other ring.Links rendered by WordPress admin pick up a shadow from
common.cssona:focus, so the rings that can be links clear it.Also removes a dead rule: the picker grid preview's focus rule, since that element never gets focus.
The README now suggests setting a custom background through
ThemeProvider, which keeps the focus ring in contrast, rather than--wp-dataviews-color-background.Left for later: arrowing through the infinite-scroll grid shows the browser's default ring on the cards, same as on
trunk.Testing Instructions
Testing Instructions for Keyboard
Same as above. Everything is reachable with Tab and the arrow keys.
Screenshots or screencast
Storybook at 1280px wide. 1x is a regular screen and 2x a high-DPI one, where the focus token is 1.5px. The selected-card screenshots compare
trunk(5cf8a15) with this PR (0fd57d5, and cc1d72e for the grid card ring). The rest comparetrunkat 37927d4 with this PR at fdbdbdd, from before the rebase. Their rings haven't changed since then.Picker grid card at 2x
Picker table row
Picker activity item
Grid preview, focused
Selected grid and picker grid cards at other scales
Table title and thumbnail
Grid title
List item (unchanged)
No story has clickable activity items, so that ring isn't pictured. The mixin gives it the same width, offset and color as before.
Use of AI Tools
Claude Code (Claude Opus 5.5) wrote the code, captured the screenshots with Playwright and drafted this description. GPT-6.2 Astra reviewed it locally over several rounds.
🤖 Generated with Claude Code