How to disable selecting whole canvas in webview in Android?

Ask by : zie1ony April 25, 2013 06:37

I have few elements that are registered with event-listeners ('touchstart'). I add it into webview. Listeners work fine, but every time I touch canvas, it selects whole canvas (like normal DOM object), after small delay it executes callback from event-listener and then unselect canvas.

My question: is there any way to disable this selection because it's unnecessary and ugly?

View original question

Answer by : hyspaceApril 25, 2013 06:37

Our team met this problem too, exactly the same as you described.

There's nothing wrong with your js code or touch handlers.

Just add a css property to your canvas element like this:

  -webkit-tap-highlight-color: transparent;

And this will fix your problem.

View original answer