Repository navigation
v0.2.1
Patch Changes
-
Security & accessibility hardening — all improvements are backwards-compatible.
Security
- ReDoS fix: SVG attribute reading now uses pre-compiled
RegExpobjects instead of runtime-constructed ones — eliminates catastrophic backtracking risk on untrusted SVG markup - Resource leak fix:
withDeadline(SVG/DOM capture) now aborts its internalAbortControlleron task completion, stopping downstream cooperative work from running after the result is already settled - Async source guard: passing an async function (returning a
Promise) as the copy source now fails immediately with a clearinvalid-payloaderror instead of silently breaking the user-gesture window required for clipboard writes
Accessibility (WCAG)
- Live region role:
LiveRegionnow usesrole="status"for all politeness levels instead ofrole="alert"for assertive —role="alert"interrupts any sentence currently being spoken, which is inappropriate for copy feedback (WCAG 4.1.3) - Mount-safe announcements: the live region no longer writes its initial message as React children — it writes imperatively via a ref after mount, preventing spurious announcements on SSR hydration and strict-mode double-mounts in JAWS / NVDA
- Non-text payload labels:
CopyField.Valuenow renders a human-readable description for non-text payloads so screen-reader users know what will be copied:html→ "Rich text",image→ "Image",json→ "JSON data",multi→ "Mixed content" - Accessible name guard:
CopyField.Triggernow guarantees a non-emptyaria-labeleven if a customtriggerLabelmessage returns an empty string
Robustness
- Ghost state eliminated: in
PasteMachine, option-resolution errors now transition directly toerrorwithout briefly passing throughreading— observers no longer see a spurious intermediate state
Performance
useMediaQuerycaching: theMediaQueryListobject is now cached in a ref and reused across renders;matchMedia()is called only when the query string changes, avoiding repeated parse/layout work on every render
- ReDoS fix: SVG attribute reading now uses pre-compiled