Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] feat(Overlay): set aria-live attribute for a11y #4900

Merged
merged 1 commit into from
Sep 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/core/src/components/overlay/overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ export class Overlay extends AbstractPureComponent2<OverlayProps, IOverlayState>
const transitionGroup = (
<TransitionGroup
appear={true}
aria-live="polite"
className={containerClasses}
component="div"
onKeyDown={this.handleKeyDown}
Expand Down
10 changes: 10 additions & 0 deletions packages/core/test/overlay/overlayTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ describe("<Overlay>", () => {
document.body.removeChild(container);
});

it("sets aria-live", () => {
// Using an open Overlay because an initially closed Overlay will not render anything to the
// DOM
mountWrapper(<Overlay className="aria-test" isOpen={true} usePortal={false} />);
const overlayElement = document.querySelector(".aria-test");
assert.exists(overlayElement);
// Element#ariaLive not supported in Firefox or IE
assert.equal(overlayElement?.getAttribute("aria-live"), "polite");
});

it("portalClassName appears on Portal", () => {
const CLASS_TO_TEST = "bp-test-content";
mountWrapper(
Expand Down