hammerjs / hammer-time

A fast click based on the touch-action css property
MIT License
100 stars 29 forks source link

touch-action problem with Android browser #28

Closed wongpeiyi closed 7 years ago

wongpeiyi commented 8 years ago

I have isolated a problem down to hammer-time on the stock Android browser. I mainly tested it on BrowserStack (HTC One M8 emulator) but can confirm it also happens on real HTC phones. Not sure if it affects the stock Android browser on other phones.

With just the below, tapping on the select box does not do anything. However, tapping on the space surrounding the select box triggers the native select dialog.

I'm not sure where to begin looking into this – does anyone have any ideas?

<!DOCTYPE html>
<html>
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta charset="utf-8">
  <title>Hammer Time</title>
  <script src="hammer-time.js"></script>
</head>
<body>
  <select style="touch-action: manipulation;">
    <option value="1">One</option>
  </select>
</body>
</html>
runspired commented 8 years ago

Which version of Android Browser / Android?

On most android devices, hammer-time will be a no-op.

arschmitz commented 8 years ago

Many if not most devices using the stock browser and not chrome as default browser don't have touch-action.

The problem here is that you can't open a selectmenu with javascript except in chrome and Safari. Since hammer time uses a generated event it will not work on select elements. This should be in the docs / readme.

wongpeiyi commented 8 years ago

Thanks for the response! I'm ok with hammer-time being a no-op, however the e.preventDefault(); on dropHammer() is breaking default functionality, i.e. select menu not opened on tap. Android 4.4, browser version 4.4.2-1314097

Or are we suggesting that hammer-time should not be used on select elements at all?

In which case, @runspired I'm actually facing this problem because of ember-hammertime automatically applying touch-action to select elements – I can open issue there if it's more appropriate.

arschmitz commented 8 years ago

Sorry for the slow response yeah i dont think hammer-time should be used on selects at all really ill discuss this with @runspired.