Skip to content

Fix mobile color picker drag bounds#326

Merged
tracygardner merged 6 commits intomainfrom
codex/fix-color-picker-positioning-on-mobile
Feb 26, 2026
Merged

Fix mobile color picker drag bounds#326
tracygardner merged 6 commits intomainfrom
codex/fix-color-picker-positioning-on-mobile

Conversation

@tracygardner
Copy link
Contributor

Motivation

  • On small screens the color picker couldn't be dragged below the canvas because vertical bounds were clamped to the canvas area height; the goal is to allow vertical dragging into the viewport while keeping horizontal movement constrained to the canvas area.

Description

  • Update the pointermove handler in ui/colourpicker.js to compute maxLeft from the parent width and maxTopInViewport from window.innerHeight - parentRect.top - pickerRect.height, and clamp left to [0, maxLeft] and top to [0, maxTopInViewport] instead of using the parent's height.

Testing

  • Ran a Playwright script that opens the dev server at a mobile viewport (390x844), clicks #colorPickerButton, and captures a screenshot of .custom-color-picker, which completed successfully and produced artifacts/color-picker-mobile.png.
  • Ran npm run build, which completed successfully.
  • Ran npx eslint ui/colourpicker.js, which failed due to pre-existing lint issues in the file (unused variables, duplicate class members, and empty block statements) unrelated to this change.

Codex Task

@tracygardner tracygardner merged commit 91c8dad into main Feb 26, 2026
5 checks passed
@tracygardner tracygardner deleted the codex/fix-color-picker-positioning-on-mobile branch February 26, 2026 16:51
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