Drafts: fix the row's interaction states and name its actions - #753
Merged
nuriapenya merged 3 commits intoSep 3, 2026
Merged
Conversation
wp-admin repaints every `<a>` on interaction: `a:hover, a:active` to #135e96 and `a:focus` to #043959. Those selectors out-specify the widget's own `color: inherit`, so a clicked draft went dark navy on dark glass, around 1.5:1 against the card it sits on. The one row you could no longer read was the one you had just opened. The colour is restated with the element in the selector, so it holds in every state. The ring is ours for the same reason: core's is the neat accent on a 2px radius, which fights the row's 8px corner and cannot promise contrast on a card that is glass over an arbitrary wallpaper. It moves to :focus-visible, because core rings on :focus and so parked a ring on the row long after the draft had opened in its window. That left a press with nothing to say, core's colour swap having gone out with the rest of the leak. It answers with the same 0.985 scale `.os-constellation__row` uses: no colour to spend, and it reads under a finger as well as a pointer.
Trash and Suggest were announcing as unnamed buttons. `<os-button>` renders its real <button> in a shadow root and forwards neither the host's aria-label nor its title, and a custom element carries no implicit role, which makes aria-label on it a prohibited attribute that assistive tech drops. The name is slotted instead, where name-from-content finds it, and the Dashicon is hidden from it: a private-use glyph would otherwise be read out. Rebuilding the list also threw focus away. Every refresh path lands in render(), which empties the container, so a poll firing while someone was tabbed onto a draft dropped them to the top of the page. The rebuild now records which draft and which control held focus and puts it back, falling through to the row that took a trashed draft's place rather than stranding focus on <body>. The applied state of a suggestion was visual only, a wash and a tinted ✓, with aria-disabled left to say "unavailable" where it meant "that one landed".
A widget can be mounted inside a window's iframe, where the global `document` is not the one its nodes live in, so focus tracking has to go through `container.ownerDocument`. Also what @wordpress/no-global-active-element asks for.
nuriapenya
marked this pull request as ready for review
September 3, 2026 17:48
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What?
Clicking a draft turned the row dark navy on dark glass, roughly 1.5:1 against the card, so the one row you could no longer read was the one you had just opened. wp-admin repaints every
<a>on interaction (a:hover, a:activeto#135e96,a:focusto#043959) and those selectors out-specify the widget's owncolor: inherit. The colour is now restated with the element in the selector, the ring is the widget's rather than core's and moves to:focus-visible, and a press answers with the same0.985scale.os-constellation__rowuses.While in there, two more. The row's Trash and Suggest buttons were announcing as unnamed buttons, because
<os-button>renders its real<button>in a shadow root and forwards neither the host'saria-labelnor itstitle, and a custom element has no role to carry a label on. The name is slotted instead. And every list refresh emptied the container, so a poll firing while you were tabbed onto a draft dropped focus to the top of the page; the rebuild now puts it back.Known gap, not fixed here:
aria-expandedon the Suggest button has the same problem as the names and cannot be fixed from the widget, because giving the host a role would nest arole="button"around a real button. That needsos-buttonto forward ARIA to its inner<button>, which would fix every icon-only caller at once.Screenshots
Testing instructions