Repository navigation
feat(tours): target elements inside open shadow roots - #222
Merged
Merged
Conversation
Tour and tooltip selectors can continue inside a shadow root with `host >>> inner`. The picker looks through shadow roots and stores such a selector, and the highlight, interaction lockout and click-to-continue handling work for an element inside one. Also removes the tour's document click listener with the capture flag it was added with; it was never removed, so a second tour in the same page load advanced two steps per click. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
TobiasDuelli
approved these changes
Nov 17, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Apps mounted inside a shadow root (Vue
defineCustomElement, Lit, a manualattachShadowmount) could not be targeted by product tours. Selectors are resolved withdocument.querySelector, which stops at the shadow boundary, and the picker only ever saw the shadow host, so every element inside picked as one.What
host >>> innercontinues inside the open shadow root ofhost, nested roots included. Handled inGleapSafeSelector, so tours, co-browse tours, the builder and tooltips resolve it. Plain selectors behave as before.host >>> innerselector. Adata-gleap-touranchor inside a shadow root gets the host prefix too.pointer-events: noneis inherited instead). For an active element inside one, the same rule is applied inline and restored afterwards.event.targetis retargeted to the host.capture: truebut removed without it, so it was never removed. A second tour in the same page load advanced two steps per click.Verification
npx jest: 767 tests pass, 8 of them new (src/GleapShadowSelector.test.js).demo/shadow-dom.html: a three-step tour highlights each element, advances on a real click in a CLICK step, ignores clicks elsewhere in the widget, and cleans up classes and inline styles on close.Not covered
>>>in its selector validation; that is a separate PR in the dashboard repo.🤖 Generated with Claude Code