Skip to content

fix: measure the overflow button edge when collapsing menu-bar items (#12791) (CP: 25.3) - #12796

Merged
DiegoCardoso merged 1 commit into
25.3from
cherry-pick-12791-to-25.3-1790005577332
Sep 21, 2026
Merged

DiegoCardoso merged 1 commit into
25.3from
cherry-pick-12791-to-25.3-1790005577332

Conversation

@vaadin-bot

Copy link
Copy Markdown
Collaborator

This PR cherry-picks changes from the original PR #12791 to branch 25.3.


Original PR description

Description

Fixes #12785

The fit check read the last remaining button's position. With theme="end-aligned" the auto margin on the first visible button moves the whole row to the end as soon as the kept buttons fit, so the next iteration measured a position that had already shifted, hid one more button, and repeated until nothing was left. Where the overflow button itself ends does not move under that shift, so the loop now compares that edge with the container width.

  • Compared the far edge of the overflow button with the container width instead of the last remaining button's position
  • Removed the separate RTL branch from the fit check, since the same edge comparison works in both directions
  • Counted the gap and the margin before the overflow button, which the previous check ignored, so the button no longer ends outside the container when --vaadin-menu-bar-gap is set
  • Added regression tests for end-aligned in both directions, for a repeated detection at an unchanged width, for widening out of a fully collapsed state, for reverseCollapse at the collapse boundary, and for --vaadin-menu-bar-gap
  • Updated the two Lumo dropdown-indicators visual baselines

Type of change

  • Bugfix

How to test

  1. Run yarn start and open dev/playground/menu-bar.html.
  2. Under Themes, check End aligned.
  3. Under Max width, select 300px. Only the items that do not fit collapse into the overflow menu.
  4. Switch Max width to 400px and back to 300px a few times. The same items stay visible every time, instead of alternating between all collapsed and a few visible.
  5. Under Collapse order, select Reverse. The same number of items stays visible, collapsing from the start instead of the end.

[!NOTE]
Counting the gap and the negative margin moves the exact-fit boundary by up to 2px. At a width inside that band one more item stays visible with Base and Aura styles. With Lumo one item fewer stays visible at the single width per boundary where the overflow button used to end outside the container and be clipped, which is what the two updated baselines show.

🤖 Generated with Claude Code

@sonarqubecloud

Copy link
Copy Markdown

@DiegoCardoso
DiegoCardoso merged commit 9605795 into 25.3 Sep 21, 2026
10 checks passed
@DiegoCardoso
DiegoCardoso deleted the cherry-pick-12791-to-25.3-1790005577332 branch September 21, 2026 16:15
@vaadin-bot

Copy link
Copy Markdown
Collaborator Author

This ticket/PR has been released with Vaadin 25.3.0.

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.

3 participants