Skip to content
This repository has been archived by the owner on Jun 9, 2022. It is now read-only.

Mistake about the readme,the late 2015 browsers still have the 300ms problem #575

Open
pansy199211 opened this issue Nov 28, 2018 · 1 comment

Comments

@pansy199211
Copy link

Note: As of late 2015 most mobile browsers - notably Chrome and Safari - no longer have a 300ms touch delay, so fastclick offers no benefit on newer browsers, and risks introducing bugs into your application. Consider carefully whether you really need to use it.

I test the below demo in the iPhone7s/iOS1.12.0/Safari, the one with <meta name="viewport" content="width=device-width">can avoid the 300ms delay, but the one without still have the 300ms delay.

Is the README above means that " As of late 2015 most mobile browsers no longer have a 300ms touch delay" only if the website is detected to be a Responsive Web " ?

Demo

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <!-- if without this line , click event will delay 300ms -->
    <meta name="viewport" content="width=device-width"> 
    <style type="text/css">
        div {
            width: 30px;
            height: 30px;
            background-color: green;
        }
    </style>
</head>
<body>
点击:
<div></div>
<ul></ul>
<script type="text/javascript">
    const div = document.getElementsByTagName('div')[0];
    div.addEventListener('touchstart', () => {
        console.log('====?touchstart');
        document.getElementsByTagName('ul')[0].innerHTML = document.getElementsByTagName('ul')[0].innerHTML + ('<li>' + Date.now() + ': touchstart </li>')
    })
    div.addEventListener('touchend', () => {
        console.log('====?touchend');
        document.getElementsByTagName('ul')[0].innerHTML = document.getElementsByTagName('ul')[0].innerHTML + ('<li>' + Date.now() + ': touchend </li>')
    })
    div.addEventListener('click', () => {
        console.log('====?click');
        document.getElementsByTagName('ul')[0].innerHTML = document.getElementsByTagName('ul')[0].innerHTML + ('<li>' + Date.now() + ': click </li>')
    })
</script>
</body>
</html>
@briancodes
Copy link

Thats a good point. You still have to add the meta tag to remove the delay

<meta name="viewport" content="width=device-width">

https://developers.google.com/web/updates/2013/12/300ms-tap-delay-gone-away

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants