Skip to content

refactor: improve menu-bar overflow detection performance (#12802) (CP: 25.2) - #12815

Merged
web-padawan merged 1 commit into
25.2from
cherry-pick-12802-to-25.2-1790093190222
Sep 22, 2026
Merged

web-padawan merged 1 commit into
25.2from
cherry-pick-12802-to-25.2-1790093190222

Conversation

@vaadin-bot

Copy link
Copy Markdown
Collaborator

This PR cherry-picks changes from the original PR #12802 to branch 25.2.


Original PR description

Description

Fixes #12783

The collapse loop wrote style on a button and then read its position on the next iteration, and each read forced a full-document layout. The loop now reads every position once, decides by arithmetic which buttons to collapse, and writes all hides in one pass.

  • Moved the measuring and the decision out of __setOverflowItems into __measureButtons and __getCollapsedButtons
    • Positions are mirrored in RTL, so one comparison serves both directions
  • Read the start margin of each button, because the first kept button keeps its own margin in front of the range
  • Read the width of the collapsed buttons before hiding any of them, so that saving the width of a button with a component costs no extra layout
  • Forced layouts per detection when the buttons overflow: 3, down from 4 to 12
  • Added a test that the overflow button position is read once per detection
  • Added a test for the start margin of the first kept button with reverseCollapse

Type of change

  • Refactor

[!NOTE]
Collapse results are unchanged: 86 integer widths, 1563 fractional widths, 2892 widths across gap, reverseCollapse and direction, and 804 zoom levels under Aura all give the same result as main, in Chromium, Firefox and WebKit on base, Lumo and Aura styles.

🤖 Generated with Claude Code

@sonarqubecloud

Copy link
Copy Markdown

@web-padawan
web-padawan merged commit 7358d53 into 25.2 Sep 22, 2026
10 checks passed
@web-padawan
web-padawan deleted the cherry-pick-12802-to-25.2-1790093190222 branch September 22, 2026 16:13
@vaadin-bot

Copy link
Copy Markdown
Collaborator Author

This ticket/PR has been released with Vaadin 25.2.9.

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.

2 participants