excalidraw/excalidraw
View on GitHubImprove Feedback: Display Error Message for Invalid Hexadecimal Color Codes
Open
#9527 opened on May 14, 2025
UX/UIenhancementgood first issue
Description
Description
Currently, Excalidraw accepts some invalid or malformed hexadecimal color values in the color input field without providing any visual or textual feedback to the user. This may cause confusion as users may not realize why the color hasn’t changed.
Steps to Reproduce
- Open Excalidraw.
- Select the pencil tool (or any tool that allows color selection).
- Open the custom color input field (hex code).
- Enter the following invalid values one at a time:
- 123456789 → more than 8 characters
- 1 → only 1 digit
- 12 → only 2 digits
- 12345 → 5 digits
- 1234567 → 7 digits
- zzzzzz → contains invalid hexadecimal characters
- blue → non-hex text input
Expected Behavior
A clear and visible error message should appear when an invalid hexadecimal value is entered, such as:
- Error: Hex code must be 3, 4, 6, or 8 characters (excluding #)
- Error: Invalid characters in hex code
- Error: Not a valid hex color
Actual Behavior
The input is ignored silently and the pencil color remains unchanged. No error or feedback is shown to the user.
Why This Matters
- Improves usability by helping users understand why their input didn’t work.
- Prevents frustration or confusion when using custom colors.
- Follows good UX practices for input validation and error feedback.
Suggested Fix
Implement front-end validation in the color input field and display an error tooltip or inline message when an invalid value is detected.