Skip to content

feat(ui-color-picker): improve ColorPicker paste behavior#2517

Merged
ToMESSKa merged 1 commit into
masterfrom
INSTUI-4834-feature-color-picker-paste-behavior-enhancement
Apr 28, 2026
Merged

feat(ui-color-picker): improve ColorPicker paste behavior#2517
ToMESSKa merged 1 commit into
masterfrom
INSTUI-4834-feature-color-picker-paste-behavior-enhancement

Conversation

@ToMESSKa

@ToMESSKa ToMESSKa commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

INSTUI-4834

ISSUE:

  • pasted hex color values can't replace existing values without manual clearing, e.g. pasting FF0000, then select all FF0000 and paste AABBCC resulted in nothing

TEST PLAN:

  • selection replacement

    • paste FF0000, then select all FF0000 and paste AABBCC, the input should become AABBCC and result in valid color
    • in FF0000, select 00 in the middle, paste FF, it input should become FFFF00 and result in valid color
  • cursor position

    • paste 0000, put the cursor at at the start of 0000 and paste FF, the input should become FF0000 and result in valid color
    • paste FF00, put the cursor in the middle of FF00 and paste AB, the input should become FFAB00 and result in valid color
    • put the cursor at the end of 0000 and Paste FF, the input should become 0000FF
  • '#' stripping

    • paste #FF0000, it should still become FF0000
    • paste FF0000, it should still become FF0000
  • length limits

    • Paste a 7-char string like FF00001, it should be still blocked
  • invalid content

    • paste ZZZZZZ, it should be still blocked

@ToMESSKa ToMESSKa self-assigned this Apr 15, 2026
@github-actions

github-actions Bot commented Apr 15, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-04-28 12:09 UTC

@@ -431,7 +431,14 @@ class ColorPicker extends Component<ColorPickerProps, ColorPickerState> {
return event.preventDefault()
}

const newHex = `${this.state.hexCode}${toPaste}`

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new pasted value previously always got appended at the end of the current one (e.g. FF0000 selected then AABBCC pasted → F0000AABBCC) and it was evaluated as invalid

@ToMESSKa ToMESSKa requested review from HerrTopi and joyenjoyer April 16, 2026 07:16

@joyenjoyer joyenjoyer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, I would add a few unit tests though

@ToMESSKa ToMESSKa force-pushed the INSTUI-4834-feature-color-picker-paste-behavior-enhancement branch from 8173aaf to ec25ec9 Compare April 24, 2026 12:01
@ToMESSKa

Copy link
Copy Markdown
Contributor Author

looks good, I would add a few unit tests though

@joyenjoyer I added some tests

@ToMESSKa ToMESSKa requested a review from joyenjoyer April 24, 2026 12:17
@ToMESSKa ToMESSKa force-pushed the INSTUI-4834-feature-color-picker-paste-behavior-enhancement branch from ec25ec9 to ea68115 Compare April 28, 2026 11:55
@ToMESSKa ToMESSKa merged commit e5c279d into master Apr 28, 2026
8 of 9 checks passed
@ToMESSKa ToMESSKa deleted the INSTUI-4834-feature-color-picker-paste-behavior-enhancement branch April 28, 2026 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants