[BUG] 'hidden' on web component still resolves a child in the shadow root as visible
See original GitHub issueContext:
System:
OS: Linux 5.4 Ubuntu 20.04.1 LTS (Focal Fossa)
Memory: 10.23 GB / 31.34 GB
Container: Yes
Binaries:
Node: 14.15.1 - ~/.local/share/nvm/v14.15.1/bin/node
npm: 6.14.8 - ~/.local/share/nvm/v14.15.1/bin/npm
Languages:
Bash: 5.0.17 - /usr/bin/bash
npmPackages:
playwright: 1.9.2 => 1.9.2
playwright-core: 1.9.2 => 1.9.2
- Browser: Chromium
Code Snippet
Proprietary project, but I got a nice picture.
The CSS of the custom element has this when this happens:
:host([hidden]) {
display: none;
}
Describe the bug
// this fails since it gets stuck here
await page.waitForSelector('#loaderIcon', {
state: 'hidden',
});
I checked with the Inspector and saw this.
pw:api waiting for selector "#loaderIcon" to be hidden +1ms
pw:api selector resolved to visible <xxx-v0-icon name="dial" id="loaderIcon"></xxx-v0-icon> +20ms
I am not sure if the above is failing either due to:
- It has problem with the web component
<xxx-base-v0-loader>
being hidden (through the “advanced” CSS above), but the ID of the element waiting to be hidden is a child element. - The inspector gets stuck at the above, never re-trying for it to be hidden. Usually I see retries in the inspector (or when using
DEBUG=pw:api
) but not this time. So maybe it was visible (expected) but then got hidden, but it was never retried if it was?
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (10 by maintainers)
Top Results From Across the Web
Shadow DOM v1 - Self-Contained Web Components
With shadow DOM, you create a scoped DOM tree that's attached to the element, but separate from its actual children. This scoped subtree...
Read more >polymer web component #shadow root not displaying
It sets the opacity to 0 - invisible. So no contents are displayed yet. After Polymer has successfully initialised all custom-elements, the ...
Read more >Using shadow DOM - Web Components | MDN
Shadow DOM allows hidden DOM trees to be attached to elements in the regular DOM tree — this shadow DOM tree starts with...
Read more >Testing Accessibility with Shadow Roots - DEV Community
Let's dig into how we can test these things to be true, and at the same time set the table for refactoring this...
Read more >A Complete Introduction to Web Components in 2022 - Kinsta
Web Components are a standard way to create reusable and modular HTML ... The Shadow DOM solves this encapsulation problem by attaching a ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@thernstig I will close this one since we cannot reproduce. If you’ll get any luck with providing a repro, please ping me and I’ll reopen and investigate.
@Diokuz That’s indeed a known issue. However, we do not have a good solution here. There are many ways to make element not really visible, and we won’t be able to account for all of them. So far, we settled for this definition. If there are common cases that we can easily account for, we’ll consider changing the definition slightly.
@yury-s would there be a chance you could assist with this?