Skip to content

Premium Analytics: keep dialog focus rings from being clipped - #52110

Open
chihsuan wants to merge 1 commit into
trunkfrom
fix/pa-dialog-focus-ring-clipping
Open

Premium Analytics: keep dialog focus rings from being clipped#52110
chihsuan wants to merge 1 commit into
trunkfrom
fix/pa-dialog-focus-ring-clipping

Conversation

@chihsuan

@chihsuan chihsuan commented Sep 9, 2026

Copy link
Copy Markdown
Member

Proposed changes

  • Replace the per-dialog padding hack in the feedback modal with one stylesheet that covers every Premium Analytics dialog.
  • Stop the dialog footer clipping the last field's focus ring, which is what the switch off dialog was showing.
  • Reserve the same clearance at the top edge, for a dialog whose content sits under a pinned header.

@wordpress/ui zeroes Dialog.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/ui bump.

Related product discussion/links

p1788862795137939-slack-C06FSDTSN82

Does this pull request change what data or activity we track or use?

No.

Testing instructions

  • Open the Stats v2 dashboard, then open Page options in the page header.
  • Choose "Switch off the preview", click into the comment box, and confirm the blue focus ring is a closed rectangle with an even gap on all four sides. On trunk its bottom edge is cut off.
  • Do the same with "Any feedback?". That dialog also has a header, so confirm the ring is fully visible there too.
  • The scroll container should report 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:

Before After
before after

Feedback modal, which has a pinned header as well as a footer, after the change:

feedback modal

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack or WordPress.com Site Helper), and enable the fix/pa-dialog-focus-ring-clipping branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack fix/pa-dialog-focus-ring-clipping
bin/jetpack-downloader test jetpack-mu-wpcom-plugin fix/pa-dialog-focus-ring-clipping

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

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:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@chihsuan
chihsuan marked this pull request as ready for review September 9, 2026 03:32
@chihsuan
chihsuan requested a review from a team as a code owner September 9, 2026 03:32
@chihsuan chihsuan added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Sep 9, 2026
@chihsuan
chihsuan requested a review from retrofox September 9, 2026 03:33
@jp-launch-control

Copy link
Copy Markdown

Code Coverage Summary

This 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. 🤷

Full summary · PHP report · JS report

@Nikschavan Nikschavan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, the changes look good.

@dognose24 dognose24 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants