Skip to content

Make colour picker commit on blur and add draggable popup#323

Closed
tracygardner wants to merge 4 commits intomainfrom
codex/add-draggable-color-picker-support
Closed

Make colour picker commit on blur and add draggable popup#323
tracygardner wants to merge 4 commits intomainfrom
codex/add-draggable-color-picker-support

Conversation

@tracygardner
Copy link
Contributor

Motivation

  • Keep the currently selected color if the user moves focus away from the colour picker (e.g., clicking outside or on the backdrop) so a selection isn't lost when the popup closes.
  • Let users reposition the colour picker by dragging so it doesn't obscure important canvas content.

Description

  • Added a drag handle element in the picker template and styles in ui/colourpicker.css to render a visible grip and set cursor: move and appropriate touch behavior.
  • Implemented pointer-based dragging in ui/colourpicker.js via a new makePopupDraggable() method that constrains the popup position to the canvas parent and sets this.userMovedPicker to preserve manual placement on reopen.
  • Centralised close behavior through a new close(options) signature with flags commitColor and triggerOnClose, and updated backdrop/outside-click handlers and confirmColor() to use these flags so outside-close commits the selected color.
  • Updated open() to skip automatic repositioning if the user has manually moved the picker, preserving the user-chosen location.

Testing

  • Built the app with npm run build, which completed successfully (build warnings about large chunks were reported but the build succeeded).
  • Launched a dev server with npm run dev and performed manual verification of the picker UI and drag behavior.
  • Ran a Playwright script that opened the app, opened the colour picker, dragged the popup via the new .color-picker-drag-handle, and captured a screenshot artifact showing the draggable popup (script executed and produced the artifact).

Codex Task

@tracygardner tracygardner deleted the codex/add-draggable-color-picker-support branch February 27, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant