Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion lib/capybara/cuprite/javascripts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,16 @@ class Cuprite {
if (style.display === "none" || style.visibility === "hidden" || parseFloat(style.opacity) === 0) {
return false;
}
node = node.parentElement ?? (node.getRootNode() instanceof ShadowRoot && node.getRootNode());

let parent = node.parentElement;
if (parent && parent.tagName === "DETAILS" && !parent.open) {
// In a closed <details> only the first <summary> (and its subtree) is rendered.
if (node !== parent.querySelector(":scope > summary")) {
return false;
}
}

node = parent ?? (node.getRootNode() instanceof ShadowRoot && node.getRootNode());
}
}

Expand Down
2 changes: 0 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ module TestSessions
node Element#drop can drop strings
node Element#drop can drop multiple strings
node Element#drop can drop a pathname
node #visible? details non-summary descendants should be non-visible
node #visible? works when details is toggled open and closed
node #set should submit single text input forms if ended with
node #shadow_root should produce error messages when failing
#has_field with valid should be false if field is invalid
Expand Down
Loading