From 9034ba4ec87d729b2e85d1a33323cf9f16fd408b Mon Sep 17 00:00:00 2001 From: Rayan Salhab Date: Sat, 28 Mar 2026 21:15:45 +0000 Subject: [PATCH 1/2] fix(accessibility): ensure screen reader announcements update consistently The useAnnouncement hook was not reliably updating screen reader announcements when dragging sortable items. This was because React batches state updates, causing consecutive identical announcements to be skipped by assistive technologies. The fix clears the announcement before setting the new value, using requestAnimationFrame to ensure the DOM update is flushed between the clear and the new announcement. This creates a detectable change that screen readers will announce. Fixes #1952 --- packages/accessibility/src/hooks/useAnnouncement.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/accessibility/src/hooks/useAnnouncement.ts b/packages/accessibility/src/hooks/useAnnouncement.ts index e1db96ea5..9cab98b4a 100644 --- a/packages/accessibility/src/hooks/useAnnouncement.ts +++ b/packages/accessibility/src/hooks/useAnnouncement.ts @@ -4,7 +4,13 @@ export function useAnnouncement() { const [announcement, setAnnouncement] = useState(''); const announce = useCallback((value: string | undefined) => { if (value != null) { - setAnnouncement(value); + // Clear the announcement first to ensure screen readers detect the change + // even when the same text is announced consecutively + setAnnouncement(''); + // Use requestAnimationFrame to ensure the clear renders before setting new value + requestAnimationFrame(() => { + setAnnouncement(value); + }); } }, []); From 614e8c2b4e44a033447c792e2e6f84a74e378e77 Mon Sep 17 00:00:00 2001 From: Rayan Salhab <7407177+cyphercodes@users.noreply.github.com> Date: Sun, 26 Apr 2026 05:23:11 +0300 Subject: [PATCH 2/2] chore: add accessibility changeset --- .changeset/stale-owls-search.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/stale-owls-search.md diff --git a/.changeset/stale-owls-search.md b/.changeset/stale-owls-search.md new file mode 100644 index 000000000..864ec7c3a --- /dev/null +++ b/.changeset/stale-owls-search.md @@ -0,0 +1,5 @@ +--- +"@dnd-kit/accessibility": patch +--- + +Fix screen reader announcements so repeated messages are announced consistently.