File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
13const { roles } = require ( 'aria-query' ) ;
24
35// Interactive ARIA roles — concrete roles whose taxonomy descends from `widget`
@@ -106,13 +108,17 @@ function buildCompositeWidgetChildren() {
106108 const out = new Set ( ) ;
107109 const kids = direct . get ( role ) ;
108110 if ( ! kids ) {
111+ closed . set ( role , out ) ;
109112 return out ;
110113 }
111114 for ( const child of kids ) {
112115 out . add ( child ) ;
113116 if ( ! visited . has ( child ) ) {
114- visited . add ( child ) ;
115- for ( const grandchild of expand ( child , visited ) ) {
117+ // Pass a fresh branch-specific visited set so sibling branches do not
118+ // contaminate each other's traversal. A shared Set across branches
119+ // makes memoized results order-dependent, because whether `child` is
120+ // recursed into depends on which sibling ran first.
121+ for ( const grandchild of expand ( child , new Set ( [ ...visited , child ] ) ) ) {
116122 out . add ( grandchild ) ;
117123 }
118124 }
You can’t perform that action at this time.
0 commit comments