Open masbaehr opened 5 years ago
This seems to be some weird timing issue, potentially related to logic to suppress accidental duplicate clicks with a touch screen.
If I put a breakpoint in the beginning of the click listener of the button clone so that it helloWorld.click()
isn't run immediately, then it works. It also works if I attach the phone to a remote debugger and use JavaScript to click the button clone.
I also tested adding a client-side click listener to the clone button that would directly do click()
on the original button without bypassing the server. This only worked if I added a delay before actually doing click()
and I tapped on some other part of the screen before that delay happened.
This can also be reproduced without any Vaadin functionality at all, so it seems like it's a browser "feature".
I can, however, suggest a workaround. You can directly trigger the click listener of the other button by using some semi-internal APIs: ComponentUtil.fireEvent(helloWorld, new ClickEvent<>(helloWorld));
.
I'll actually close this issue since it seems like we cannot really do anything about the way the browser ignores element.click()
in some specific situations.
Cool thanks for the workaround it is enough to avoid the issue :)
I traced down the issue to https://github.com/Polymer/polymer/issues/5289. The ticket suggests a workaround in the form of dispatching a non-bubbling event instead of doing element.click()
. This is something we could do in Button.click()
. I'll move the issue there.
See the related workaround in vaadin-upload
component.
Also, starting from Polymer 3.3.0, there is a global setting for this:
import { setCancelSyntheticClickEvents } from '@polymer/polymer/lib/utils/settings.js';
setCancelSyntheticClickEvents(false);
Hi, i am experiencing a strange issue with mobile browsers. On a Desktop Browser both buttons refresh the UI, but on a mobile browser they don't. However the Server Method is called in both cases. Analyzing the console output i noticed that the "StateTree after applying changes" statement is never printed on Mobile Chrome + Mobile Firefox, but on Desktop yes. So it seems some XHR message cannot be parsed or executed.
MWE: