Skip to content

Commit e54c3e5

Browse files
committed
tour click prevent when outside and type is CLICK
1 parent 8bf001d commit e54c3e5

File tree

8 files changed

+33
-4
lines changed

8 files changed

+33
-4
lines changed

build/cjs/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/esm/index.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

demo/index.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,9 @@ <h2 class="sub-headline">
259259
<div class="header-container-image">
260260
<img class="head-image" src="./pexels-niklas-jeromin-12734294.jpg" />
261261
</div>
262+
<input type="button" value="Start Tour" placeholder="helloo"/>
263+
<input type="text" id="userInput" placeholder="Enter your name">
264+
<button onclick="greetUser()">Submit</button>
262265
<div class="content" id="haha">
263266
<div class="skeleton-text"></div>
264267
<div class="skeleton-text"></div>
@@ -268,6 +271,17 @@ <h2 class="sub-headline">
268271
<div class="skeleton-text"></div>
269272
<div class="skeleton-text"></div>
270273
</div>
274+
275+
<script>
276+
function greetUser() {
277+
var name = document.getElementById("userInput").value;
278+
if (name) {
279+
alert("Hello, " + name + "! Welcome to Off-Grid-it-Haus.");
280+
} else {
281+
alert("Please enter your name.");
282+
}
283+
}
284+
</script>
271285
</body>
272286

273287
</html>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gleap",
3-
"version": "14.0.0",
3+
"version": "14.0.1",
44
"main": "build/cjs/index.js",
55
"module": "build/esm/index.mjs",
66
"exports": {

published/14.0.1/index.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

published/latest/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/GleapProductTours.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export default class GleapProductTours {
7474

7575
var driverStep = {
7676
disableActiveInteraction: disableInteraction,
77+
mode: step.mode,
7778
popover: {
7879
description: message,
7980
popoverClass: `gleap-tour-popover-${step.type} ${!hasSender && 'gleap-tour-popover-no-sender'} ${config.allowClose && 'gleap-tour-popover-can-close'}`,
@@ -104,6 +105,11 @@ export default class GleapProductTours {
104105
const step = steps[stepIndex];
105106
const element = gleapTourObj.getActiveElement();
106107

108+
if (step?.mode === "CLICK" && evnt?.target !== element) {
109+
// Ignore clicks outside of the actual element.
110+
return;
111+
}
112+
107113
if ((element && element.tagName === 'INPUT') || step.mode === "INPUT" || evnt?.target?.id.includes("tooltip-svg")) {
108114
// Prevent.
109115
} else {

src/GleapTours.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,10 @@ const GleapTours = function () {
964964
const activeIndex = getState("activeIndex");
965965
const activeStep = getState("__activeStep");
966966
const activeElement = getState("__activeElement");
967+
968+
if (activeStep.mode === "CLICK") {
969+
return;
970+
}
967971
if (typeof activeIndex === "undefined" || typeof activeStep === "undefined") {
968972
return;
969973
}
@@ -989,6 +993,10 @@ const GleapTours = function () {
989993
const activeIndex = getState("activeIndex");
990994
const activeStep = getState("__activeStep");
991995
const activeElement = getState("__activeElement");
996+
997+
if (activeStep.mode === "CLICK") {
998+
return;
999+
}
9921000
if (typeof activeIndex === "undefined" || typeof activeStep === "undefined") {
9931001
return;
9941002
}

0 commit comments

Comments
 (0)