Skip to content

πŸ’­ Dream window: gradient-style β€” clearing a stop's color deletes the stop - #140

Open
argyleink wants to merge 2 commits into
mainfrom
dream/firefox-copy
Open

argyleink wants to merge 2 commits into
mainfrom
dream/firefox-copy

Conversation

@argyleink

Copy link
Copy Markdown
Owner

Problem

Clearing a color stop's text field left the stop in place with an empty color, so the gradient went invalid until you typed something or found Remove in the stop's menu (#81). Separately, Remove on the last stop used splice(position, 2), which only removed the stop and left a dangling hint at the end of the list.

Solution

  • Empty a stop's color text (or leave only whitespace) and leave the field: the stop is deleted along with one neighboring transition hint. The list keeps exactly one hint between each pair of stops.
  • If it's the only color stop, it gets back the color it had on focus instead (or a random oklch if it was already empty).
  • Switching windows or tabs doesn't count as leaving the field (document.hasFocus() guard), so an alt-tab mid-edit won't eat the stop.
  • New pure helper removeStopAt() in src/utils/stops.ts. The blur path and the Remove menu both use it: the last stop takes the hint before it, so Remove no longer leaves a dangling hint. 5 unit tests in src/utils/removeStop.test.ts.

Verified with Playwright in Chromium and Firefox at 1440px and at 390px with reduced motion. With 4 stops I emptied the middle stop, then the last one. Both were removed, the hint count stayed at stops βˆ’ 1, and the CSS snippet stayed valid. Two undos restored both stops with their original colors, and emptying the only stop restored its color. No page errors. WebKit wasn't checked: Playwright WebKit crashes on this machine even on the live gradient.style. Checks: npm test (129 passing), npm run lint and npm run build all pass. svelte-check shows the same baseline errors as main.

I also tried #100 (Firefox can't copy the snippets) in Playwright Firefox: the snippet Copy button and Global Actions β†’ Copy modern CSS both reached navigator.clipboard.writeText and resolved. It doesn't reproduce in current Firefox, so it's probably safe to close. This PR doesn't touch it.

Impact

Fixes #81. Deleting a stop is now as quick as clearing its text, which matches how people already try to do it. The Remove action stops leaving a trailing hint behind.

πŸ€– Generated with Claude Code

argyleink and others added 2 commits November 26, 2026 03:45
Emptying a stop's color text and leaving the field removes that stop
(with one neighboring transition hint). The only color stop gets its
previous color back. A window/tab switch doesn't count as leaving.

The Remove menu action now shares removeStopAt(), which takes the hint
before the last stop instead of leaving a dangling trailing hint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@netlify

netlify Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

βœ… Deploy Preview for hd-gradients ready!

Name Link
πŸ”¨ Latest commit 03db2d7
πŸ” Latest deploy log https://app.netlify.com/projects/hd-gradients/deploys/6b081c37ab0b047ac703a11f
😎 Deploy Preview https://deploy-preview-140--hd-gradients.netlify.app
πŸ“± Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

argyleink added a commit that referenced this pull request Nov 26, 2026
@argyleink

Copy link
Copy Markdown
Owner Author

Screenshots

chromium-1440.png

firefox-390-rm.png

argyleink added a commit that referenced this pull request Nov 26, 2026
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.

blur an empty color stop input, delete the stop

1 participant