Skip to content

Commit

Permalink
internal: fixes issue where aria-live region was not updated properly
Browse files Browse the repository at this point in the history
  • Loading branch information
sashamilenkovic committed Dec 9, 2024
1 parent a68f27a commit eaeeabd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,8 @@ function setActive<T>(
parent,
};

addNodeClass([newActiveNode.el], activeDescendantClass);

state.activeState.parent.el.setAttribute(
"aria-activedescendant",
state.activeState.node.el.id
Expand Down Expand Up @@ -627,12 +629,12 @@ function setSelected<T>(
}

function updateLiveRegion<T>(parent: ParentRecord<T>, message: string) {
const parentId = parent.el.id;

const liveRegion = document.getElementById(parentId + "-live-region");
const liveRegion = document.querySelector('[data-dnd-live-region="true"]');

if (!liveRegion) return;

liveRegion.id = parent.el.id + "-live-region";

liveRegion.textContent = message;
}

Expand Down

0 comments on commit eaeeabd

Please sign in to comment.