1717import { parseAttributeSelector } from '@isomorphic/selectorParser' ;
1818import { normalizeWhiteSpace } from '@isomorphic/stringUtils' ;
1919
20- import { beginAriaCaches , endAriaCaches , getAriaChecked , getAriaDisabled , getAriaExpanded , getAriaLevel , getAriaPressed , getAriaRole , getAriaSelected , getElementAccessibleDescription , getElementAccessibleName , isElementHiddenForAria , kAriaCheckedRoles , kAriaExpandedRoles , kAriaLevelRoles , kAriaPressedRoles , kAriaSelectedRoles } from './roleUtils' ;
20+ import { beginAriaCaches , endAriaCaches , getAriaBusy , getAriaChecked , getAriaDisabled , getAriaExpanded , getAriaLevel , getAriaPressed , getAriaRole , getAriaSelected , getElementAccessibleDescription , getElementAccessibleName , isElementHiddenForAria , kAriaCheckedRoles , kAriaExpandedRoles , kAriaLevelRoles , kAriaPressedRoles , kAriaSelectedRoles } from './roleUtils' ;
2121import { matchesAttributePart } from './selectorUtils' ;
2222
2323import type { AttributeSelectorOperator , AttributeSelectorPart } from '@isomorphic/selectorParser' ;
@@ -37,10 +37,11 @@ type RoleEngineOptions = {
3737 expanded ?: boolean ;
3838 level ?: number ;
3939 disabled ?: boolean ;
40+ busy ?: boolean ;
4041 includeHidden ?: boolean ;
4142} ;
4243
43- const kSupportedAttributes = [ 'selected' , 'checked' , 'pressed' , 'expanded' , 'level' , 'disabled' , 'name' , 'description' , 'include-hidden' ] ;
44+ const kSupportedAttributes = [ 'selected' , 'checked' , 'pressed' , 'expanded' , 'level' , 'disabled' , 'busy' , ' name', 'description' , 'include-hidden' ] ;
4445kSupportedAttributes . sort ( ) ;
4546
4647function validateSupportedRole ( attr : string , roles : string [ ] , role : string ) {
@@ -106,6 +107,12 @@ function validateAttributes(attrs: AttributeSelectorPart[], role: string): RoleE
106107 options . disabled = attr . op === '<truthy>' ? true : attr . value ;
107108 break ;
108109 }
110+ case 'busy' : {
111+ validateSupportedValues ( attr , [ true , false ] ) ;
112+ validateSupportedOp ( attr , [ '<truthy>' , '=' ] ) ;
113+ options . busy = attr . op === '<truthy>' ? true : attr . value ;
114+ break ;
115+ }
109116 case 'name' : {
110117 if ( attr . op === '<truthy>' )
111118 throw new Error ( `"name" attribute must have a value` ) ;
@@ -157,6 +164,8 @@ function queryRole(scope: SelectorRoot, options: RoleEngineOptions, internal: bo
157164 return ;
158165 if ( options . disabled !== undefined && getAriaDisabled ( element ) !== options . disabled )
159166 return ;
167+ if ( options . busy !== undefined && getAriaBusy ( element ) !== options . busy )
168+ return ;
160169 if ( ! options . includeHidden ) {
161170 const isHidden = isElementHiddenForAria ( element ) ;
162171 if ( isHidden )
0 commit comments