Skip to content

Fixed vertical alignment in flex layouts#335

Merged
vytisbulkevicius merged 2 commits intodevelopmentfrom
bugfix/271
Apr 23, 2026
Merged

Fixed vertical alignment in flex layouts#335
vytisbulkevicius merged 2 commits intodevelopmentfrom
bugfix/271

Conversation

@girishpanchal30
Copy link
Copy Markdown
Contributor

Summary

Handled vertical alignment for elements inside flex containers by using align-self instead of vertical-align, which is not supported in flex layouts.

Check before Pull Request is ready:

Closes #271

@girishpanchal30 girishpanchal30 requested a review from Copilot April 17, 2026 06:33
@girishpanchal30 girishpanchal30 added the pr-checklist-skip Allow this Pull Request to skip checklist. label Apr 17, 2026
@pirate-bot pirate-bot added the pr-checklist-complete The Pull Request checklist is complete. (automatic label) label Apr 17, 2026
@pirate-bot
Copy link
Copy Markdown
Contributor

pirate-bot commented Apr 17, 2026

Plugin build for f80a5e5 is ready 🛎️!

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses frontend vertical alignment issues for menu icons inside flex containers by augmenting the generated icon styles with align-self (flex-friendly) handling, and by narrowing/normalizing the available vertical alignment values.

Changes:

  • Removed unsupported/legacy vertical-align options from the settings UI.
  • Added backward-compatibility normalization for stored vertical_align values.
  • Updated frontend inline-style generation to add align-self derived from vertical_align, plus a helper to map values.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
includes/settings.php Removes several vertical-align choices from the settings field.
includes/meta.php Normalizes legacy vertical_align values to supported ones for backward compatibility.
includes/front.php Adds align-self output and mapping logic during icon inline-style generation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread includes/front.php Outdated
Comment thread includes/front.php Outdated
Comment thread includes/meta.php
Comment on lines +106 to +112
// Backward-compatibility: values removed in favour of align-self support.
$supported_vertical_align = array( 'top', 'middle', 'bottom', 'baseline' );
if ( isset( $value['vertical_align'] ) &&
! in_array( $value['vertical_align'], $supported_vertical_align, true )
) {
$value['vertical_align'] = 'middle';
}
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

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

This backward-compatibility block overwrites any previously-saved vertical_align values outside the new supported list (e.g. super, sub, text-top, text-bottom) to middle. Those legacy values are still valid CSS for non-flex layouts, so this migration can cause a visible change for existing sites/themes that are not using flex menus. Consider preserving the legacy vertical_align value for the vertical-align: CSS output, while only mapping/fallbacking align-self to a supported value (or providing a more explicit migration strategy).

Suggested change
// Backward-compatibility: values removed in favour of align-self support.
$supported_vertical_align = array( 'top', 'middle', 'bottom', 'baseline' );
if ( isset( $value['vertical_align'] ) &&
! in_array( $value['vertical_align'], $supported_vertical_align, true )
) {
$value['vertical_align'] = 'middle';
}
// Preserve legacy vertical-align values for backward compatibility.

Copilot uses AI. Check for mistakes.
Comment thread includes/settings.php
Comment on lines 532 to 536
'vertical_align' => array(
'id' => 'vertical_align',
'type' => 'select',
'label' => __( 'Vertical Align', 'menu-icons' ),
'default' => 'middle',
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

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

The vertical_align settings choices have been reduced to 4 values. Combined with the migration in Menu_Icons_Meta::get() that forces legacy values to middle, this is a backwards-incompatible change for users who previously selected super/sub/text-top/text-bottom on non-flex menus (those CSS values are still valid outside flex). Consider keeping the legacy options (perhaps marked as deprecated/“legacy”) or ensuring the migration preserves prior behavior where possible.

Copilot uses AI. Check for mistakes.
@vytisbulkevicius vytisbulkevicius merged commit 7edcae3 into development Apr 23, 2026
7 checks passed
@vytisbulkevicius vytisbulkevicius deleted the bugfix/271 branch April 23, 2026 11:23
@pirate-bot
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.13.23 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@pirate-bot pirate-bot added the released Indicate that an issue has been resolved and released in a particular version of the product. label Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-checklist-complete The Pull Request checklist is complete. (automatic label) pr-checklist-skip Allow this Pull Request to skip checklist. released Indicate that an issue has been resolved and released in a particular version of the product.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants