Skip to content

Commit

Permalink
fix: add role="log" detection
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio committed Jul 4, 2021
1 parent 7cbc32b commit ed880af
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/utils.ts
Expand Up @@ -68,7 +68,7 @@ export function resolvePolitenessSetting(node: Node | null): PolitenessSetting {
if (isPolitenessSetting(ariaLive)) return ariaLive;

const role = node.getAttribute('role');
if (role === 'status') return 'polite';
if (role === 'status' || role === 'log') return 'polite';
if (role === 'alert') return 'assertive';

if (node.tagName.toLowerCase() === 'output') {
Expand Down
3 changes: 2 additions & 1 deletion test/utils.ts
@@ -1,11 +1,12 @@
interface TestAttributes {
name?: 'role' | 'aria-live';
value?: 'status' | 'alert' | 'assertive' | 'polite';
value?: 'status' | 'alert' | 'log' | 'assertive' | 'polite';
tag?: 'div' | 'output';
}

export const POLITE_CASES: TestAttributes[] = [
{ name: 'role', value: 'status' },
{ name: 'role', value: 'log' },
{ name: 'aria-live', value: 'polite' },
{ tag: 'output' },
];
Expand Down

0 comments on commit ed880af

Please sign in to comment.