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

Feature: Change default option values #532

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions lib/fastclick.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
*
* @type number
*/
this.touchBoundary = options.touchBoundary || 10;
this.touchBoundary = options.touchBoundary || 30;


/**
Expand All @@ -93,14 +93,21 @@
*
* @type number
*/
this.tapDelay = options.tapDelay || 200;
this.tapDelay = options.tapDelay || 30;

/**
* The maximum time for a tap
*
* @type number
*/
this.tapTimeout = options.tapTimeout || 700;
this.tapTimeout = options.tapTimeout || 1000;

/**
* Them minimum tap time for element that needs focus
*
* @type number
*/
this.focusDelay = options.focusDelay || 100;

if (FastClick.notNeeded(layer)) {
return;
Expand Down Expand Up @@ -571,7 +578,8 @@

// Case 1: If the touch started a while ago (best guess is 100ms based on tests for issue #36) then focus will be triggered anyway. Return early and unset the target element reference so that the subsequent click will be allowed through.
// Case 2: Without this exception for input elements tapped when the document is contained in an iframe, then any inputted text won't be visible even though the value attribute is updated as the user types (issue #37).
if ((event.timeStamp - trackingClickStart) > 100 || (deviceIsIOS && window.top !== window && targetTagName === 'input')) {
// The default value for this.focusDelay is 100ms.
if ((event.timeStamp - trackingClickStart) > this.focusDelay || (deviceIsIOS && window.top !== window && targetTagName === 'input')) {
this.targetElement = null;
return false;
}
Expand Down