fix(SplitButton): prevent menu position shift on close#3241
fix(SplitButton): prevent menu position shift on close#3241YehudaMenahem wants to merge 3 commits intomondaycom:masterfrom
Conversation
PR Reviewer Guide 🔍(Review updated until commit 42b8188)Here are some key observations to aid the review process:
|
5bf6a30 to
a00a0cf
Compare
|
Quick update after further investigation 👋 I replaced the previous |
|
Follow-up improvement: The fix moves the press-scale from the SplitButton wrapper to the inner buttons, keeping the exact same visual feedback while preventing any layout / bounding-box changes that affect menu positioning. |
User description
Label
bug fix
User description
Description
Fixes a visual glitch in SplitButton where the menu briefly shifts position when closing.
Root cause
While the menu is open / closing, the SplitButton wrapper applies a press-scale animation (transform: scale(0.95)), which temporarily changes the reference element’s size. This causes the menu position to be recalculated and results in a short top-left jump before unmount.
Solution
Disable the press-scale animation on the SplitButton wrapper while the menu is open. This keeps the reference size stable during close and prevents the position glitch.
Tradeoff
The press animation is skipped only during menu close. This avoids layout instability with a minimal, CSS-only change and no JS or lifecycle intervention.
Alternative (not implemented)
A JS-based solution could lock the menu position during close or delay recalculation, but would add complexity and runtime cost compared to the current approach.
Resolves #3129
PR Type
Bug fix
Description
Prevents menu position shift when closing SplitButton
Disables press-scale animation while menu is open
Maintains stable reference element size during close
Diagram Walkthrough
File Walkthrough
SplitButton.module.scss
Add CSS rule to disable press-scale during menu openpackages/core/src/components/SplitButton/SplitButton.module.scss
.active.splitContentOpento override press-scaleanimation
transform: nonewhen split menu is open to prevent layout shiftPR Type
Bug fix
Description
Moves press-scale animation from wrapper to individual buttons
Prevents menu position shift when closing SplitButton
Maintains stable reference element size during menu close
Adds transform-origin for proper button scaling
Diagram Walkthrough
File Walkthrough
SplitButton.module.scss
Refactor press animation to individual buttonspackages/core/src/components/SplitButton/SplitButton.module.scss
.buttonwrapper selector.mainButtonand.secondaryButtontransform-originproperties (right center, left center) forproper scaling
.activeselector to target individual buttons instead ofwrapper