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
[BUG] Page.click() doesn't work when pointer-events: none is toggled off #2175
Comments
Hi Steve. This one sounds like it is catching a real bug on the website. I would think that the real user will try to click on the button, and nothing is going to happen. At least that's what I did myself. Perhaps, in the real app it looks differently? What do you think? |
Thanks for looking into this @dgozman. In the real app, the page is in a loading state and the developer added So yes, maybe we should change the app code. :) But I just want to double-check - do you consider this a bug in playwright? Is this use case of toggling |
While checking for hittarget, we first bubble from a target element up to find the first element without `pointer-events: none` style. While doing so, we can bubble all the way up to the parent. In reality, we should not bubble past meaningful elements, such as: - `BUTTON` - `INPUT` - `A` - `LABEL` The list of tags is taken from [Cypress](https://docs.cypress.io/api/commands/contains.html#Preferences) which applies a similar tactic for their selector processing. Fixes microsoft#2175
While checking for hittarget, we first bubble from a target element up to find the first element without `pointer-events: none` style. While doing so, we can bubble all the way up to the parent. In reality, we should not bubble past meaningful elements, such as: - `BUTTON` - `INPUT` - `A` The list of tags is taken from [Cypress](https://docs.cypress.io/api/commands/contains.html#Preferences) which applies a similar tactic for their selector processing. However, we don't use `LABEL` as a boundary since we've seen labels inside buttons. Fixes microsoft#2175
While checking for hittarget, we first bubble from a target element up to find the first element without `pointer-events: none` style. While doing so, we can bubble all the way up to the parent. In reality, we should not bubble past meaningful elements, such as: - `BUTTON` - `INPUT` - `A` The list of tags is taken from [Cypress](https://docs.cypress.io/api/commands/contains.html#Preferences) which applies a similar tactic for their selector processing. However, we don't use `LABEL` as a boundary since we've seen labels inside buttons. Fixes microsoft#2175
While checking for hittarget, we first bubble from a target element up to find the first element without `pointer-events: none` style. This bubbling does not make much sense: we risk desperately clicking "body" element, when we were actually asked to click some deeply-nested "span". Additionally, in many cases the original intent is to click a button. In this case, we should use the enclosing "button" as a hit target directly. Fixes microsoft#2175
While checking for hittarget, we first bubble from a target element up to find the first element without `pointer-events: none` style. This bubbling does not make much sense: we risk desperately clicking "body" element, when we were actually asked to click some deeply-nested "span". Additionally, in many cases the original intent is to click a button. In this case, we should use the enclosing "button" as a hit target directly. Fixes #2175
Context:
Code Snippet
Describe the bug
Hey team. Hope all is well and you had a great weekend.
I have a page with a button that's not clickable until 5s after the page loads. I'd expect playwright to still click the button since this is well within the 30s default timeout, but it doesn't appear to wait for
pointer-events
to be enabled. It seems like it tries to click it before they're enabled and fails and never tries again.Here's a link to the code sandbox for easy viewing of the source code. https://codesandbox.io/s/awesome-dijkstra-f1t94?file=/src/App.js
Thanks for taking a look!
The text was updated successfully, but these errors were encountered: