Treat closed <details> non-summary descendants as non-visible#317
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adjusts Cuprite’s client-side visibility detection to match the HTML rendering model for closed <details> elements, allowing previously-skipped Capybara #visible? shared specs to run and pass.
Changes:
- Update
_cuprite.isVisibleto treat non-<summary>descendants of a closed<details>as not visible. - Unskip two Capybara
#visible?shared specs inspec/spec_helper.rbthat are now expected to pass.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
spec/spec_helper.rb |
Removes two #visible? examples from the skip list now that the driver behavior matches expectations. |
lib/capybara/cuprite/javascripts/index.js |
Enhances ancestor-walk visibility logic to account for closed <details> hiding non-summary content. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Treats non-summary descendants of a closed
<details>element as non-visible, un-skipping 2 Capybara#visible?shared specs.Why
_cuprite.isVisiblewalked the ancestor chain checking onlydisplay:none/visibility:hidden/opacity:0. A closed<details>hides its non-summary children via the rendering model, not computeddisplay— sogetComputedStyle(child).displayisblockand those children were reported visible.How
In the
isVisibleancestor walk: if a node's parent is a<details>without[open]and the node is not that details' first<summary>, returnfalse.<details>.<summary>(and its subtree) stays visible; a second<summary>is correctly hidden.!parent.openshort-circuits); toggling reads the live.openstate.Testing
details non-summary descendants should be non-visible when closed,works when details is toggled open and closed), alongside the already-passing closed-summary-visible and open-details-visible specs.#visible?/ visibility examples, 0 failures.bundle exec rubocopclean.Part of #307.
🤖 Authored with agent assistance.