respect elements that are hidden by <details> - #1165
VinceMalone wants to merge 2 commits into
Conversation
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit d510c45:
|
snowystinger
left a comment
There was a problem hiding this comment.
Thanks for the PR, a few items
If you don't have time or don't recall, no worries, just let me know and I can take it over.
| <input hidden /> | ||
| <input style="visibility: hidden"/> | ||
| <input style="display: none"/> | ||
| <details> |
There was a problem hiding this comment.
these tests are invalid html, a details must have a summary followed by flow content
| return false | ||
| } | ||
| if (visibility === 'hidden') { | ||
| if (visibility === 'hidden' || visibility === 'collapse') { |
There was a problem hiding this comment.
where is visibility collapse tested? I removed that or and every test is passing
| if (previousElement) { | ||
| detailsVisibility = | ||
| element.nodeName === 'DETAILS' && previousElement.nodeName !== 'SUMMARY' | ||
| ? element.hasAttribute('open') |
There was a problem hiding this comment.
better to check element.open? you can set a details open with js by doing detailsElement.open = true
What:
stop considering elements hidden by a collapsed
<details>element to be visible or focusable, viagetTabDestination().for example,
user.tab()should not focus elements hidden by a collapseddetailsancestor.Why:
same reasons for how
.toBeVisibleworks in jest-domgiven the following code:
button#hiddenshould not be considered visible, nor should it be focusable, butbutton#visibleshould.How:
at least for conveniences sake, i copied the same logic from jest-dom for determining if an element should be considered visible when walking the element tree (with one exception: looking for the
hiddenattribute — this caused an issue that i think might be a bug in that library)Checklist: