Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
boehlerlukas committed Sep 14, 2024
2 parents 10193fe + e54c3e5 commit 22606e9
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
14 changes: 14 additions & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,9 @@ <h2 class="sub-headline">
<div class="header-container-image">
<img class="head-image" src="./pexels-niklas-jeromin-12734294.jpg" />
</div>
<input type="button" value="Start Tour" placeholder="helloo"/>
<input type="text" id="userInput" placeholder="Enter your name">
<button onclick="greetUser()">Submit</button>
<div class="content" id="haha">
<div class="skeleton-text"></div>
<div class="skeleton-text"></div>
Expand All @@ -268,6 +271,17 @@ <h2 class="sub-headline">
<div class="skeleton-text"></div>
<div class="skeleton-text"></div>
</div>

<script>
function greetUser() {
var name = document.getElementById("userInput").value;
if (name) {
alert("Hello, " + name + "! Welcome to Off-Grid-it-Haus.");
} else {
alert("Please enter your name.");
}
}
</script>
</body>

</html>
1 change: 1 addition & 0 deletions published/14.0.1/index.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/GleapProductTours.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export default class GleapProductTours {

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

if (step?.mode === "CLICK" && evnt?.target !== element) {
// Ignore clicks outside of the actual element.
return;
}

if ((element && element.tagName === 'INPUT') || step.mode === "INPUT" || evnt?.target?.id.includes("tooltip-svg")) {
// Prevent.
} else {
Expand Down
8 changes: 8 additions & 0 deletions src/GleapTours.js
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,10 @@ const GleapTours = function () {
const activeIndex = getState("activeIndex");
const activeStep = getState("__activeStep");
const activeElement = getState("__activeElement");

if (activeStep.mode === "CLICK") {
return;
}
if (typeof activeIndex === "undefined" || typeof activeStep === "undefined") {
return;
}
Expand All @@ -989,6 +993,10 @@ const GleapTours = function () {
const activeIndex = getState("activeIndex");
const activeStep = getState("__activeStep");
const activeElement = getState("__activeElement");

if (activeStep.mode === "CLICK") {
return;
}
if (typeof activeIndex === "undefined" || typeof activeStep === "undefined") {
return;
}
Expand Down

0 comments on commit 22606e9

Please sign in to comment.