Skip to content

Add clickAnywhere functionality to handle clicks#52

Open
nikhilsathyanarayana-lab wants to merge 2 commits into
masterfrom
click-anywhere
Open

Add clickAnywhere functionality to handle clicks#52
nikhilsathyanarayana-lab wants to merge 2 commits into
masterfrom
click-anywhere

Conversation

@nikhilsathyanarayana-lab

Copy link
Copy Markdown

Hi team, I've taken a crack at adding something to the repo.
Hope I followed the instrutions ok and that my code won't break!

Comment thread guides/advancingGuides/clickAnywhere/js.js Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a “click anywhere to advance” snippet under guides/advancingGuides/ intended to advance a Pendo guide step when the user clicks outside the guide UI.

Changes:

  • Introduces a global click listener that advances the guide via pendo.onGuideAdvanced().
  • Ignores clicks that occur inside Pendo guide DOM elements.
  • Removes the listener after the first qualifying click.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +13
function handleClick(event) {
// Ignore clicks inside any Pendo guide
if (event.target.closest('[id^="pendo-"], [class*="_pendo-"], .pendo-guide')) {
return;
}
try {
pendo.onGuideAdvanced();
} catch (e) {}

parent.document.removeEventListener('click', handleClick, true);
}

parent.document.addEventListener('click', handleClick, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants