Repository navigation
Editor: De-duplicate the collaborators overlay styles with a CSS module - #87862
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: -32 B (0%) Total Size: 8.85 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
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. should undo without broken temporary state in
|
Mamaduka
left a comment
There was a problem hiding this comment.
Thanks for the follow-up, @ciampo! The migration looks good to me.
I think we can drop the :has() selector and move the z-index to .overlay. The cover is absolutely positioned without its own z-index, so it doesn't create a stacking context, and the result should be the same. I haven't tested this in the browser.
Happy to drop the e2e test. It needs a two-user session to check a single media query, and the assertion has to land within the 2s highlight window, so it could become flaky.
The collaborators overlay renders in the canvas iframe, so it injected its styles as CSS written in TypeScript strings, with hand-made copies of the Avatar SCSS and of base-styles values. A CSS module reaches the iframe through @wordpress/style-runtime and can load the Avatar SCSS directly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The overlay styles now load in every registered document, so the cover rule reached every block canvas cover, including other fills and covers without an overlay. Lift only the cover that holds the overlay, and leave the positioning to the cover's own inline styles. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reduced-motion rule listed the cursor labels, but they only animate through the highlight rule, which is more specific, so the pulse after jumping to a collaborator kept running. Run the pulse only when the user hasn't asked for reduced motion. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without the overlay stylesheet the caret has no animation, so the test passed whether or not the styles reached the canvas. Assert that the caret blinks without a motion preference before checking reduced motion. Add a changelog entry for the visible fixes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The block canvas cover has no z-index, so it doesn't create a stacking context. A z-index on the overlay stacks it the same way, without a :has() rule that reaches the cover.
It needs a two-user session to check one media query, and its assertion has to land inside the 2s highlight window, so it could become flaky.
a0cb36e to
e5c9998
Compare
|
They're failing because they check if any of the dependenceis that we're listing are less than 1 day old. The check was triggered by the fact that this PR modified the package-lock. It was meant as a security check, but I admit it's noisy and not really useful as it stands. I'll look into it |
What?
Follow-up to #87841 (follow-up 1).
The collaborators overlay now gets its canvas styles from a CSS module,
collaborators-overlay/style.module.scss, instead of about 380 lines of CSS in TypeScript strings.Why?
The TypeScript strings copied the Avatar SCSS and
base-stylesvalues by hand, and they had already drifted. Two rules never worked:rgba(#fff, 0.7), which is invalid CSS outside Sass.This is also the first step toward moving the collaborator UI to the
@wordpress/uiAvatar(#87841).How?
@wordpress/style-runtime, now a dependency of@wordpress/editor.Details
z-index. The block canvas cover has noz-index, so it doesn't create a stacking context, and the overlay stacks as it did when trunk lifted the whole cover. Other fills of the cover are unaffected..is-collaborator-selected,.collaborators-overlay-cursor-highlighted(added by the cursor registry), the classes the e2e tests query, and the keyframes.z-indexrules that JS generated fromMAX_BLOCK_LABEL_AVATARSare an SCSS loop. The constant moves tooverlay.tsx, and a comment links the two.selected-block-focusmixin frombase-styles. It now uses the mixin with the collaborator color.@media not (prefers-reduced-motion). There's no automated test: it would need a two-user session to check one media query, and its assertion would have to land inside the 2s highlight window.11pxare now the--wpds-typography-*tokens the Avatar SCSS uses, with the same values. The unused.collaborators-overlay-fixedrule is removed.@wordpress/editorloads, not when the overlay mounts. Without an overlay, they match nothing.Testing Instructions
Testing Instructions for Keyboard
No interaction changes.
Screenshots or screencast
Collaborator block outline, zoomed in 4×. Before is trunk (
59501fd8406), After is this branch.Full captures
Post editor on
wp-env, as the second user. Captured with a temporary Playwright spec that isn't part of this PR.Block outline on. Only the inner ring differs.
Block outline off. Identical pixel for pixel.
Use of AI Tools
Written with Claude Code (Claude Opus 5.5), at my direction: Claude made the change, captured the screenshots, and drafted this description.
🤖 Generated with Claude Code