You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
onMouseDown causes splash on real ios browsers #12717
unexpected grey splash caused by onMouseDown on real ios device's browsers, both safari and chrome. Please checkout this grey splash issue first
I did some trial later, and find out that vanilla html <button onmousedown="">btn</button> doesn't cause grey splash, but with React's jsx <button onMouseDown={()=>{}}></button>, there is a noticeable grey splash
What is the expected behavior?
who wants a splash?
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
The splashes the author is referring to occur not when you click on the button, but when you click on the body itself several times in a quick succession.
Hmm.. there was clearly some issue with how I was testing this. It appears that CodeSandbox preview mode is buggy. I'll need to look at it again — for now previous conclusions might be wrong.
If I remove <!DOCTYPE html> in the beginning, the flash is gone
If I change document.addEventListener to document.body.addEventListener (or get even more specific), the flash is also gone
It seems like the proper solution to this will be #2043. In the meantime, you can probably work around it by not adding mouse event listeners on touch devices (and instead using touch event listeners). Sorry about that!
Reacted by Philipp Spiess, Olivier Tassinari and Joseph Kohlmann
Reacted by Matt, Joseph Kohlmann and Josna battula
Activity
gaearon commentedon Aug 2, 2018
Can you create a reproducible example?
gaearon commentedon Aug 6, 2018
For future reference, the reproducing example is this:
https://codesandbox.io/s/p3npm3o6j7
The splashes the author is referring to occur not when you click on the button, but when you click on the body itself several times in a quick succession.
gaearon commentedon Aug 6, 2018
The problem is not specific to React; this also reproduces it:
gaearon commentedon Aug 6, 2018
Here is what Polymer does:
https://github.com/Polymer/polymer/blob/59405b57b3f7f3732b7f1db07ef1a76b1871814e/lib/utils/gestures.js#L92-L93
https://github.com/Polymer/polymer/blob/59405b57b3f7f3732b7f1db07ef1a76b1871814e/lib/utils/gestures.js#L210
https://github.com/Polymer/polymer/blob/59405b57b3f7f3732b7f1db07ef1a76b1871814e/lib/utils/gestures.js#L545-L547
gaearon commentedon Aug 6, 2018
Hmm.. there was clearly some issue with how I was testing this. It appears that CodeSandbox preview mode is buggy. I'll need to look at it again — for now previous conclusions might be wrong.
gaearon commentedon Aug 6, 2018
Okay, testing this in CodeSandbox was really confusing because of some other code it bundles in.
I think I got to a minimal repro though:
There are two things that "fix" it:
<!DOCTYPE html>in the beginning, the flash is gonedocument.addEventListenertodocument.body.addEventListener(or get even more specific), the flash is also goneIt seems like the proper solution to this will be #2043. In the meantime, you can probably work around it by not adding mouse event listeners on touch devices (and instead using touch event listeners). Sorry about that!
philipp-spiess commentedon Aug 6, 2018
This seems to be the minimal example to reproduce this issue. What's strange about this:
mousedownandclickseem to work) is attached to the document.* { -webkit-tap-highlight-color: red; }, the tap will still be grey, even though a button might turn red.<!DOCTYPE html>does fix it as well. (as @gaearon pointed out earlier).You can try it out without the CodeSandbox chrome using this URL: https://yjy8j5v5rz.codesandbox.io/
I'm downloading a few older iOS versions now to see when this was added.
philipp-spiess commentedon Aug 6, 2018
@gaearon You beat me to it 😬
Here's another workaround I found 🤔 :
philipp-spiess commentedon Aug 6, 2018
I don't think that #2043 would be a fix for this issue. If you mount your React app into a container that is big enough to fill the whole screen (which most React apps probably are) and then add the click listener to that container, the same issue persists: https://codesandbox.io/s/o4x23pr8m6
What's different with the non-
documentlisteners though:<!DOCTYPE html>or not.-webkit-tap-highlight-color: transparent;to remove it.I've filed a WebKit issue for the behavior we're seeing with
documentas it seems very inconsistent: https://bugs.webkit.org/show_bug.cgi?id=188362