-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Support aria-disabled attribute on web components #5855
Comments
Took liberty in renaming this to explicitly request aria-disabled. That's the one custom buttons should be using. |
Isn't that a distinct, new feature request you changed this to? A Web Component can be created by extending existing elements such as HTMLSelectElement, which has https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement/disabled It should be up to me to then have |
When you extend an existing element, such as HTMLSelectElement or HTMLButtonElement, you construct the element via Your example is different, because the button is inside the the shadow root. From playwrights perspective, your selector should be pointing to that inner button rather than the wrapper. And then we would correctly find that the button is disabled. If its open shadow dom, we should be finding the inner button today anyway, and correcting waiting for the disabled attribute to be removed. Do you have a real world example of it not working? Are you using closed shadow dom? |
We are using open shadow DOM, and my web component can be set like this: <awesome-v0-button id="apply-button" disabled> Note in this case, the LitElement (since we use polymer), is not a So you are saying that when I have created a Web Component, adding a The semantics of E.g. I do believe this part works fine In addition, you can see examples of this being used here: https://developers.google.com/web/fundamentals/web-components/customelements and later in CSS here https://developers.google.com/web/fundamentals/web-components/customelements#reflectattr |
You can add an attribute named disabled all you want, but its not going to do anything special. For example, the |
I believe that you have a disabled button inside your component yes? So actionability checks should already be working for you. If they don't work, that's a bug and I'd like to see your html so I can repro and fix it :). |
Regarding bugs, there is a bug, and it is being worked on. See: I took a look at the specs. See https://html.spec.whatwg.org/multipage/semantics-other.html#disabled-elements, which links to a form-associated custom element https://html.spec.whatwg.org/multipage/custom-elements.html#form-associated-custom-element. In that case it least, Also to be more precise, more elements should be matched against But yes, you are correct that none of these seem to pertain to my case with "any custom element" :( |
I have a fix for this, with associated tests, just trying to figure out how to raise an MR. I've essentially replaced line 421 of /src/server/injected/injectedScript.ts with
From https://www.w3.org/TR/html-aria/
Essentially all roles currently defined allow the aria-disabled attribute. This would be disabled: |
Why was this issue closed?We are prioritizing the features based on the upvotes, recency and activity in the issue thread. It looks like this issue only has a handful of upvotes, has not been touched recently and/or we lack sufficient feedback to act on it. We are closing issues like this one to keep our bug database maintainable. Please feel free to open a new issue and link this one to it if you think this is a mistake. |
I have a custom web component with a shadow DOM attached. If I add the
disabled
attribute to the web component, the Enabled actionability check will still click it immediately, passing the enabled check. From the docs:Considering my element is not any of those above, Playwright will try to click the web component before
disabled
is removed as an attribute, which times out my test.I think it would be nice that if a web component as disabled attached to it, Playwright should wait for the web component to remove that attribute in order to pass the Enabled actionability check.
Example:
I tried to click on it like this:
It does work if I change it to this:
But I think the former is kind of nice for web components.
The text was updated successfully, but these errors were encountered: