Premium Analytics: keep dialog focus rings from being clipped - #52110
Premium Analytics: keep dialog focus rings from being clipped#52110chihsuan wants to merge 1 commit into
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryThis PR did not change code coverage! That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷 |
Nikschavan
left a comment
There was a problem hiding this comment.
Thank you, the changes look good.
dognose24
left a comment
There was a problem hiding this comment.
Checked the two selectors against the installed @wordpress/ui 0.21.0: Dialog.Header / Dialog.Footer render <header> / <footer> by default, Dialog.Content carries data-wp-ui-overlay-scroll-container, and since the package's rules all live in @layer wp-ui, this unlayered shim wins regardless of specificity. The non-pinned shape (header inside Content) is correctly left alone by ~, same as upstream.
One note for the description: AlertDialog renders its chrome as <div>s, so the shim does not reach it. Premium Analytics does not use AlertDialog, so nothing is affected today.
Two non-blocking suggestions inline. Approving.
|
|
||
| [data-wp-ui-overlay-scroll-container]:has(~ footer) { | ||
| padding-block-end: calc(var(--wpds-border-width-focus) * 2); | ||
| } |
There was a problem hiding this comment.
Upstream (WordPress/gutenberg#82443) also subtracts the same clearance from the adjacent chrome padding, so the header-to-content and content-to-footer gaps stay unchanged. This shim only does the first half, so each pinned edge is currently 3px taller than trunk, and it will shrink back by that much when the @wordpress/ui bump drops the shim.
Mirroring the other half makes the bump a pure no-op:
header:has(~ [data-wp-ui-overlay-scroll-container]) {
padding-block-end: calc(var(--wpds-dimension-gap-lg) - 1px - var(--wpds-border-width-focus) * 2);
}
[data-wp-ui-overlay-scroll-container] ~ footer {
padding-block-start: calc(var(--wpds-dimension-gap-lg) - 1px - var(--wpds-border-width-focus) * 2);
}The - 1px is the separator border slot 0.21.0 already reserves on pinned chrome; the whole value has to be restated because the shim cannot reference the layered rule's value.
| Significance: patch | ||
| Type: fixed | ||
|
|
||
| Dialogs: keep the comment field's focus ring from being clipped by the dialog footer. |
There was a problem hiding this comment.
This is a user-visible fix, so it should also get entries in the plugins that render the dashboard, matching what #52060, #51882 and #51772 did (plugins/jetpack and plugins/premium-analytics, plus plugins/wpcomsh in #51772). Otherwise it only reaches the package changelog. For example:
jp changelog add plugins/jetpack -s patch -t bugfix -e "Premium Analytics: keep the dialog focus ring from being clipped by the dialog footer."
jp changelog add plugins/premium-analytics -s patch -t fixed -e "Dialogs: keep the focus ring from being clipped by the dialog footer."
Proposed changes
@wordpress/uizeroesDialog.Content's block padding on the edge that meets pinned chrome, and the scroll container then clips a focus ring, which sits twice the focus width outside its control. This was fixed upstream in WordPress/gutenberg#82443, but no released version carries it yet, so this is a local shim to drop on the next@wordpress/uibump.Related product discussion/links
p1788862795137939-slack-C06FSDTSN82
Does this pull request change what data or activity we track or use?
No.
Testing instructions
padding-block-end: 3px, which matches the ring's 1.5px width plus its 1.5px offset.Screenshots
Captured on a Jurassic Ninja site running this branch. "Before" is the same page with the two new rules switched off, since this change adds nothing else.
Switch off dialog:
Feedback modal, which has a pinned header as well as a footer, after the change: