From ddf993e7df64799e5fd843c2be2c28823396d194 Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Tue, 10 Apr 2018 19:31:58 +0200 Subject: [PATCH] Move next on click of overlay --- index.html | 1 + readme.md | 2 +- src/common/constants.js | 1 - src/index.js | 4 ++-- types/index.d.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index f4b6a14..dc4b06f 100644 --- a/index.html +++ b/index.html @@ -272,6 +272,7 @@ driver.highlight({ opacity: 0.75, // Background opacity (0 means only popovers and without overlay) padding: 10, // Distance of element from around the edges allowClose: true, // Whether clicking on overlay should close or not + overlayClickNext: false, // Should it move to next step on overlay click doneBtnText: 'Done', // Text on the final button closeBtnText: 'Close', // Text on the close button for this step nextBtnText: 'Next', // Next button text for this step diff --git a/readme.md b/readme.md index 0595142..dc5f40c 100644 --- a/readme.md +++ b/readme.md @@ -160,7 +160,7 @@ const driver = new Driver({ opacity: 0.75, // Background opacity (0 means only popovers and without overlay) padding: 10, // Distance of element from around the edges allowClose: true, // Whether the click on overlay should close or not - outsideClickNext: false, // Whether the click on overlay should move next + overlayClickNext: false, // Whether the click on overlay should move next doneBtnText: 'Done', // Text on the final button closeBtnText: 'Close', // Text on the close button for this step stageBackground: '#ffffff', // Background color for the staged behind highlighted element diff --git a/src/common/constants.js b/src/common/constants.js index d6d91e0..486eb23 100644 --- a/src/common/constants.js +++ b/src/common/constants.js @@ -3,7 +3,6 @@ export const OVERLAY_PADDING = 10; export const SHOULD_ANIMATE_OVERLAY = true; export const SHOULD_OUTSIDE_CLICK_CLOSE = true; - export const SHOULD_OUTSIDE_CLICK_NEXT = false; export const ESC_KEY_CODE = 27; diff --git a/src/index.js b/src/index.js index dbfaafb..53bb84e 100644 --- a/src/index.js +++ b/src/index.js @@ -32,7 +32,7 @@ export default class Driver { padding: OVERLAY_PADDING, // Spacing around the element from the overlay scrollIntoViewOptions: null, // Options to be passed to `scrollIntoView` allowClose: SHOULD_OUTSIDE_CLICK_CLOSE, // Whether to close overlay on click outside the element - outsideClickNext: SHOULD_OUTSIDE_CLICK_NEXT, // Whether to move next on click outside the element + overlayClickNext: SHOULD_OUTSIDE_CLICK_NEXT, // Whether to move next on click outside the element stageBackground: '#ffffff', // Background color for the stage onHighlightStarted: () => { // When element is about to be highlighted }, @@ -89,7 +89,7 @@ export default class Driver { const clickedHighlightedElement = highlightedElement.node.contains(e.target); const clickedPopover = popover && popover.contains(e.target); - if (!clickedHighlightedElement && !clickedPopover && this.options.outsideClickNext) { + if (!clickedHighlightedElement && !clickedPopover && this.options.overlayClickNext) { this.moveNext(); return; } diff --git a/types/index.d.ts b/types/index.d.ts index bc95101..a73a628 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -649,7 +649,7 @@ declare module 'driver.js' { * Clicking outside the highlighted element should move next * @default false */ - outsideClickNext?: boolean, + overlayClickNext?: boolean, /** * Background color for the stage behind the highlighted element