File tree 1 file changed +19
-19
lines changed
1 file changed +19
-19
lines changed Original file line number Diff line number Diff line change @@ -41,27 +41,27 @@ export function interactWithFirstInteractiveElement(
41
41
// Try to find and interact with elements in priority order
42
42
const elementFound = interactiveElements . some ( ( { selector, action } ) => {
43
43
const element = containerElement . querySelector ( selector ) as HTMLElement ;
44
- if ( element ) {
45
- switch ( action ) {
46
- case 'click' :
47
- element . click ( ) ;
48
- break ;
49
- case 'focus' :
50
- element . focus ( ) ;
51
- break ;
52
- case 'toggle' :
53
- if ( element instanceof HTMLDetailsElement ) {
54
- element . open = ! element . open ;
55
- } else {
56
- element . click ( ) ;
57
- }
58
- break ;
59
- default :
44
+ if ( ! element ) {
45
+ return false ;
46
+ }
47
+ switch ( action ) {
48
+ case 'click' :
49
+ element . click ( ) ;
50
+ break ;
51
+ case 'focus' :
52
+ element . focus ( ) ;
53
+ break ;
54
+ case 'toggle' :
55
+ if ( element instanceof HTMLDetailsElement ) {
56
+ element . open = ! element . open ;
57
+ } else {
60
58
element . click ( ) ;
61
- }
62
- return true ; // Stop the loop once we've found and acted on an element
59
+ }
60
+ break ;
61
+ default :
62
+ element . click ( ) ;
63
63
}
64
- return false ;
64
+ return true ;
65
65
} ) ;
66
66
67
67
// If no specific interactive element was found, try using the SELECTORS constant
You can’t perform that action at this time.
0 commit comments