Skip to content

wpcomsh: Keep gifting banner buttons readable under theme styles and long labels - #54668

Merged
taipeicoder merged 9 commits into
trunkfrom
fix/wpcomsh-gifting-banner-buttons
Nov 9, 2026
Merged

taipeicoder merged 9 commits into
trunkfrom
fix/wpcomsh-gifting-banner-buttons

Conversation

@taipeicoder

@taipeicoder taipeicoder commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Why

Atomic sites whose plan is about to expire show visitors a black banner: "Enjoy this site? Gift the author a WordPress.com plan.", followed by a "?" link to the gifting docs and a white "Gift" button. Both buttons were styled with single-class selectors, so a theme's or page builder's own button rules beat them. Under Elementor's site kit, Hello Elementor or Twenty Twenty, the "?" turns into a coloured padded box with its icon drawn outside it, and "Gift" takes the theme's colours.

The Gift button also had a fixed height and was allowed to shrink. On phones, two-word translations ("Hediye et", "Cadeau geven", "Berikan hadiah") wrapped onto a second line that was cut off. Separately, the "?" button had no text, so screen readers announced it only as "button".

Proposed changes

  • Scope the banner's button styles to the banner itself and reset inherited button styles, so theme rules no longer restyle the "?" or Gift button. Both get a white keyboard focus ring.
  • Keep the Gift label on one line and let the button grow to fit it, with tighter side padding on small screens.
  • Hide the 🎁 on screens 480px and narrower. It could wrap onto a line of its own there, which a Gift button that no longer shrinks made more likely.
  • Give the "?" button the accessible name "Learn more".
  • Bump the asset version on the WordPress.com Simple path so cached copies refresh. Atomic already versions the assets by the wpcomsh version.

The same fix is being made to the WordPress.com copy of this banner; the two files are kept in sync.

Related product discussion/links

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

No.

Screenshots

Hello Elementor with an Elementor kit that colours buttons.

Before After
At rest Before: pink box offset from the ? icon, pink Gift button After: plain white ? icon, white Gift button
"?" keyboard focus Before: focused ? stays a pink box After: white focus ring around the ? icon

Turkish at 360px, on a theme that leaves buttons unstyled (the banner's own CSS only).

Before After
Before: Gift label reads Hediye, with et cut off After: full Hediye et label on one line, gift image hidden

Testing instructions

Prerequisites: an Atomic site running wpcomsh from this branch, with a paid plan, the Hello Elementor theme, and the Elementor plugin with a kit that sets a button background colour (Site Settings › Buttons).

Theme button styles

  1. Force the banner on: wp option update wpcom_gifting_subscription 1
  2. Open the site's front end logged out.
  3. Check the banner: the "?" is a plain white icon right after the sentence, and "Gift" is a white button with black text. Previously the "?" sat in a box in the kit's button colour, offset from its icon, and "Gift" took the kit's colour.
  4. Press Tab until the "?" is focused, then once more for "Gift": each shows a white outline and keeps its colours. Hovering "Gift" also keeps it white.

Long labels on mobile

  1. Set the site language to Türkçe (Settings › General).
  2. Open the front end at a 320px-wide viewport.
  3. The button reads "Hediye et" on one line, fully visible. Previously "et" wrapped and was cut off.

Accessible name

  1. Inspect the "?" button: it has aria-label="Learn more".

🤖 Generated with Claude Code

…long labels

Theme and page-builder button rules (Elementor's site kit, Hello Elementor's
focus style, Twenty Twenty) outranked the banner's single-class selectors, so
the "?" turned into a coloured box offset from its icon and the Gift button
took the theme's colours. Scope both buttons to the banner ID and reset
inherited styles.

The Gift button also had a fixed height and could shrink, so multi-word
labels such as Turkish "Hediye et" wrapped and were clipped on mobile.
Keep the label on one line and let the button size to it.

Give the "?" button an accessible name, and bump the wpcom-path asset
version so cached copies refresh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 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 (WordPress.com Site Helper), and enable the fix/wpcomsh-gifting-banner-buttons branch.

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 Nov 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!


Wpcomsh plugin:

  • Next scheduled release: Atomic deploys happen twice daily on weekdays (p9o2xV-2EN-p2)

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jp-launch-control

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/plugins/wpcomsh/frontend-notices/gifting-banner/gifting-banner.php 25/106 (23.58%) -0.45% 2 ❤️‍🩹

Full summary · PHP report

taipeicoder and others added 7 commits November 9, 2026 13:30
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reverts the more_info check: no other localized-data read in the
monorepo guards against a stale page cache, and the lapse is brief.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pages cached before the deploy can load this script with data that has no
more_info, which would set aria-label to "undefined".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The phone subtitle line is 15px tall, so the 22px "?" box pushed the icon
below the text and made the banner taller.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On narrow screens it could wrap onto a line of its own, which happened
more often once the Gift button stopped shrinking.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@taipeicoder
taipeicoder marked this pull request as ready for review November 9, 2026 06:41
@taipeicoder
taipeicoder merged commit 82ac762 into trunk Nov 9, 2026
82 of 83 checks passed
@taipeicoder
taipeicoder deleted the fix/wpcomsh-gifting-banner-buttons branch November 9, 2026 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant