-
-
Notifications
You must be signed in to change notification settings - Fork 11.4k
fix: preserve stylesPanelMode during canvas reset to prevent mobile color picker UI corruption #10253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix: preserve stylesPanelMode during canvas reset to prevent mobile color picker UI corruption #10253
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@Hell1213 is attempting to deploy a commit to the Excalidraw Team on Vercel. A member of the Team first needs to authorize it. |
|
based on my testing, the solution does work. |
…olor picker UI corruption - Preserve stylesPanelMode in actionClearCanvas to maintain mobile UI state - Add ResizeObserver to MobileShapeActions for proper width measurement - Fixes issue where color picker would show broken layout after canvas reset on mobile - Ensures mobile color picker always displays full interface with proper styling Fixes excalidraw#10252
9621a22 to
fb859e6
Compare
|
hey @zsviczian Thanks for pointing that out! I’ve removed the excalidraw.code-workspace file and updated the PR. |
|
@dwelle pr is ready to review |
|
@Hell1213 Thanks for working on this! We've moved away from /cc @zsviczian @dwelle |
Description
Fixes #10252 - Color picker falls apart after resetting the canvas on the new mobile UI
This PR addresses a critical mobile UI bug where the color picker would display incorrectly after canvas reset, showing only basic color swatches instead of the full expanded interface.
Root Cause
The issue was caused by two problems:
actionClearCanvas), thestylesPanelModewas being reset to"full"instead of preserving the current mode ("mobile"for mobile devices)MobileShapeActionscomponent was using synchronous width measurement that could fail during re-renders after canvas resetSolution
1. Preserve stylesPanelMode during canvas reset
actionClearCanvasto preserve the currentstylesPanelModevaluestylesPanelMode: "mobile"which is required for proper color picker display2. Improve width measurement reliability
useEffectwithResizeObserverfor accurate width measurementResizeObserveris not availableBefore/After Screenshots
Before (Broken)
The color picker shows only basic horizontal color swatches with "Stroke" text - broken layout after canvas reset.

After (Fixed)
The color picker displays the full expanded interface with proper sections: Background, Colors, Shades, Hex code - working correctly after canvas reset.
=>
Screencast.from.2025-10-26.14-29-36.mp4
Testing
Technical Details
The fix ensures that:
stylesPanelModestatecompactModepropsCloses #10252