diff --git a/.changeset/stale-crabs-protect.md b/.changeset/stale-crabs-protect.md new file mode 100644 index 0000000..834e7f6 --- /dev/null +++ b/.changeset/stale-crabs-protect.md @@ -0,0 +1,7 @@ +--- +"@kaizen/button": patch +--- + +Fix aria-polite presence on buttons without working states. +* The aria-live="polite" will only be added when a workingLabel is provided to the button. + * This will mean the content should only be read when inner content updates on buttons with working states \ No newline at end of file diff --git a/draft-packages/menu/KaizenDraft/Menu/__snapshots__/Menu.spec.tsx.snap b/draft-packages/menu/KaizenDraft/Menu/__snapshots__/Menu.spec.tsx.snap index 04406b5..0f5ed06 100644 --- a/draft-packages/menu/KaizenDraft/Menu/__snapshots__/Menu.spec.tsx.snap +++ b/draft-packages/menu/KaizenDraft/Menu/__snapshots__/Menu.spec.tsx.snap @@ -6,7 +6,6 @@ exports[`Dropdown renders default view 1`] = ` class="buttonWrapper" > + )} + /> + ) + const button = getByTestId("id--generic-test") + const buttonContainer = button.parentElement + + expect(buttonContainer).toHaveAttribute("aria-live", "polite") + }) +}) diff --git a/packages/button/src/Button/components/GenericButton.tsx b/packages/button/src/Button/components/GenericButton.tsx index c5128a7..c5069f3 100755 --- a/packages/button/src/Button/components/GenericButton.tsx +++ b/packages/button/src/Button/components/GenericButton.tsx @@ -60,6 +60,7 @@ export type WorkingProps = { export type WorkingUndefinedProps = { working?: false + workingLabel?: string } type Props = ButtonProps & { @@ -116,7 +117,7 @@ const GenericButton = forwardRef( styles.container, props.fullWidth && styles.fullWidth )} - aria-live="polite" + aria-live={props.workingLabel ? "polite" : undefined} > {determineButtonRenderer()}