Skip to content

fix(animation): align welcome notice button icons - #3178

Open
faisalahammad wants to merge 1 commit into
Codeinwp:masterfrom
faisalahammad:fix/3169-welcome-notice-icon-align
Open

faisalahammad wants to merge 1 commit into
Codeinwp:masterfrom
faisalahammad:fix/3169-welcome-notice-icon-align

Conversation

@faisalahammad

Copy link
Copy Markdown

Closes #3169.

Summary

The external-link icon on the "Learn More" button in the Blocks Animation welcome notice sat about 15px below the text. The notice only shows when Blocks Animation is active without Otter.

WordPress core applies line-height: 2.3 to dashicons inside .button-hero (wp-includes/css/buttons.min.css). That value assumes inline buttons. The notice turns its buttons into flex containers with align-items: center, so the icon's 20px box gets a ~46px line box and the glyph renders below the centered text.

This resets the icon line-height to the dashicons base value, scoped to the notice:

.button.button-hero .dashicons {
	line-height: 1;
}

The full selector .otter-animation-welcome-notice .button.button-hero .dashicons (0,5,0) wins over core's .wp-core-ui .button.button-hero .dashicons (0,4,0) regardless of load order. The same offset on the primary button's spinner icon is fixed too. CSS only, no PHP/JS/markup changes.

Screenshots

Before (from #3169):

Icon sits below the Learn More text

After: the icon sits vertically centered next to the label.


Test instructions

  1. On a test site without Otter Blocks, install and activate the standalone Blocks Animation plugin (the notice only renders when Otter is not present).
  2. If the notice does not appear, it was dismissed or expired. Delete the otter_animation_dismiss_welcome_notice and otter_animation_welcome_notice_display_time options and reload.
  3. Open Dashboard (the notice also shows on Plugins and Themes).
  4. Check the "Learn More" button: the external icon is vertically centered with the text, about 5px to its right.
  5. Click "Install & Activate Otter Blocks" and watch the spinner: it stays centered with the label.
  6. Optional: check a viewport under 1200px and an RTL install. The same rule ships in the RTL stylesheet.

Expected: both icons aligned, no other visual changes to the notice.


Checklist before the final review

  • Included E2E or unit tests for the changes in this PR.
  • Visual elements are not affected by independent changes.
  • It is at least compatible with the minimum WordPress version.
  • It loads additional script in frontend only if it is required.
  • Does not impact the Core Web Vitals.
  • In case of deprecation, old blocks are safely migrated.
  • It is usable in Widgets and FSE.
  • Copy/Paste is working if the attributes are modified.
  • PR is following the best practices

Note on tests: this is a CSS-only change and the repo has no style test harness. The compiled LTR and RTL CSS were checked for the rule, lint passes, and the fix was confirmed manually on a standalone install.

WordPress core sets line-height: 2.3 on dashicons inside hero
buttons. That works for inline buttons, but the welcome notice
buttons are flex containers, so the tall line box pushes the
glyph below the label. The external icon on the Learn More
button sat about 15px under the text.

Reset the icon line-height to the dashicons base value, scoped
to the notice. Covers both hero buttons, LTR and RTL.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Button icon misaligned in the Blocks Animation welcome notice

1 participant