7
7
/**
8
8
* Accessibility Object Model reflective aria property name types.
9
9
*/
10
- export type ARIAProperty = Exclude < keyof ARIAMixin , 'role' > ;
10
+ export type ARIAProperty = keyof ARIAMixin ;
11
11
12
12
/**
13
13
* Accessibility Object Model reflective aria properties.
14
14
*/
15
15
export const ARIA_PROPERTIES : ARIAProperty [ ] = [
16
+ 'role' ,
16
17
'ariaAtomic' ,
17
18
'ariaAutoComplete' ,
18
19
'ariaBusy' ,
@@ -72,7 +73,7 @@ export const ARIA_ATTRIBUTES = ARIA_PROPERTIES.map(ariaPropertyToAttribute);
72
73
* @return True if the attribute is an aria attribute, or false if not.
73
74
*/
74
75
export function isAriaAttribute ( attribute : string ) : attribute is ARIAAttribute {
75
- return attribute . startsWith ( 'aria-' ) ;
76
+ return attribute . startsWith ( 'aria-' ) || attribute === 'role' ;
76
77
}
77
78
78
79
/**
@@ -84,9 +85,7 @@ export function isAriaAttribute(attribute: string): attribute is ARIAAttribute {
84
85
* @param property The aria property.
85
86
* @return The aria attribute.
86
87
*/
87
- export function ariaPropertyToAttribute < K extends ARIAProperty | 'role' > (
88
- property : K ,
89
- ) {
88
+ export function ariaPropertyToAttribute < K extends ARIAProperty > ( property : K ) {
90
89
return (
91
90
property
92
91
. replace ( 'aria' , 'aria-' )
@@ -101,8 +100,8 @@ type ARIAPropertyToAttribute<K extends string> =
101
100
K extends `aria${infer Suffix } Element${infer OptS } `
102
101
? `aria-${Lowercase < Suffix > } `
103
102
: K extends `aria${infer Suffix } `
104
- ? `aria-${Lowercase < Suffix > } `
105
- : K ;
103
+ ? `aria-${Lowercase < Suffix > } `
104
+ : K ;
106
105
107
106
/**
108
107
* An extension of `ARIAMixin` that enforces strict value types for aria
0 commit comments