File tree Expand file tree Collapse file tree
lib/capybara/cuprite/javascripts Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -85,7 +85,16 @@ class Cuprite {
8585 if ( style . display === "none" || style . visibility === "hidden" || parseFloat ( style . opacity ) === 0 ) {
8686 return false ;
8787 }
88- node = node . parentElement ?? ( node . getRootNode ( ) instanceof ShadowRoot && node . getRootNode ( ) ) ;
88+
89+ let parent = node . parentElement ;
90+ if ( parent && parent . tagName === "DETAILS" && ! parent . open ) {
91+ // In a closed <details> only the first <summary> (and its subtree) is rendered.
92+ if ( node !== parent . querySelector ( ":scope > summary" ) ) {
93+ return false ;
94+ }
95+ }
96+
97+ node = parent ?? ( node . getRootNode ( ) instanceof ShadowRoot && node . getRootNode ( ) ) ;
8998 }
9099 }
91100
Original file line number Diff line number Diff line change @@ -56,8 +56,6 @@ module TestSessions
5656 node Element#drop can drop strings
5757 node Element#drop can drop multiple strings
5858 node Element#drop can drop a pathname
59- node #visible? details non-summary descendants should be non-visible
60- node #visible? works when details is toggled open and closed
6159 node #set should submit single text input forms if ended with
6260 #has_field with valid should be false if field is invalid
6361 #has_element? should be true if the given element is on the page
You can’t perform that action at this time.
0 commit comments