Skip to content

fix(color-converter): announce palette clipboard failures - #431

Merged
anurag629 merged 2 commits into
codercops:developfrom
srikar-naidu:fix/color-clipboard-error-feedback
Oct 30, 2026
Merged

anurag629 merged 2 commits into
codercops:developfrom
srikar-naidu:fix/color-clipboard-error-feedback

Conversation

@srikar-naidu

Copy link
Copy Markdown
Contributor

What and why

Handles clipboard failures in the Color Converter’s HEX, RGB, and HSL command palette actions.

When clipboard access is blocked, each action now shows the existing error toast, which is announced through the notification system’s polite live region.

Closes #426

How I tested this

  • npm run lint — passed with develop’s existing 11 warnings.
  • npm run test — all 2,459 tests passed.
  • Added regression tests for rejected clipboard access in all three palette actions, verifying that each rejection is handled and produces exactly one error toast.
  • npm run build — started; result pending.
  • Manual screen-reader verification remains pending.

AI assistance

AI helped implement the error handling, add regression tests, and run validation.

Type of change

  • Bug fix
  • New tool or feature
  • Tests
  • Refactor or cleanup
  • Docs

Checklist

  • I was assigned the linked issue
  • npm run lint && npm run test && npm run build passes locally
  • Logic changes live in lib/ and have a test in lib/__tests__/
  • For a bug fix: the new test fails without my change
  • No analytics, trackers, or calls that send user data off-device
  • Works in both light and dark themes (if UI changed)
  • Inputs have labels and it works with the keyboard alone (if UI changed)
  • New tool: registry entry, page.tsx, client component, opengraph-image.tsx, and the bug report dropdown are all done

Notes for reviewers

Scoped to the three missing failure handlers identified by the maintainer. Reuses the existing accessible toast system without adding another live region.

The changes and regression tests belong to the Color Converter component because they cover command palette UI callbacks. No new tool, input, styling, or conversion logic was introduced.

The regression tests pass with the fix; a separate run against the original implementation has not been performed.

@bhushan4work

Copy link
Copy Markdown
Contributor

thanks for working on this, @srikar-naidu! the error handling cleanly addresses the unhandled clipboard rejections in the command palette actions, and matching the "could not copy clipboard blocked" toast message from copybutton keeps feedback consistent across the app.

all existing unit tests and lint checks pass cleanly. a couple of minor suggestions to make the test suite even more robust before merging:

  1. cover the success path in tests:
    right now, [colorconverterclient.test.tsx](https://github.com/codercops/toolbelt/pull/app/(tools)/color-converter/colorconverterclient.test.tsx) tests the rejection branch. it would be great to also test the resolved path to verify that writetext is called with the expected color string and triggers push("copied <format> to clipboard", "success").

  2. verify value arguments:
    in the rejection test, asserting expect(writetext).tohavebeencalledwith(...) in addition to tohavebeencalledonce() would ensure each action passes the right format (hexvalue, rgbvalue, hslvalue).

  3. screen-reader verification:
    whenever you get a chance to test with voiceover/nvda as mentioned in the pr description, please check off the manual verification box.

@srikar-naidu

Copy link
Copy Markdown
Contributor Author

@bhushan4work Thanks for the suggestions!!! Added success-path coverage and exact clipboard value assertions for HEX, RGB, and HSL in both success and rejection cases. All 10 Color Converter tests pass.

also... are u allowed to review the issues which i kept?? if yes can u check these
#430 #432

@bhushan4work

Copy link
Copy Markdown
Contributor

@srikar-naidu wait for the maintainer to make the final review before merging , dont do any further changes until a maintainer walks in .

@anurag629 anurag629 added the hacktoberfest-accepted PR counts for Hacktoberfest label Oct 30, 2026
@anurag629
anurag629 merged commit 57edae4 into codercops:develop Oct 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest-accepted PR counts for Hacktoberfest

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Accessibility: announce clipboard copy results to screen readers

3 participants