question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] 'hidden' on web component still resolves a child in the shadow root as visible

See original GitHub issue

Context:

  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.

shadowDomHidden

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:

  1. 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.
  2. 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:closed
  • Created 3 years ago
  • Comments:11 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
dgozmancommented, Apr 16, 2021

@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.

0reactions
thernstigcommented, Jun 14, 2021

@yury-s would there be a chance you could assist with this?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found