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.
Problem
The helping layer in Intro.js is incorrectly positioned when a Chrome extension adds a bar at the top of the page. This occurs because the additional bar alters the page's layout.
How to Recreate
Download the Chrome Extension
Use the following link to install the extension:
Ahrefs SEO Toolbar
Visit the Intro.js Website
Open the Intro.js website and click on the Live Demo button.
Observe the Error
You will notice that the helping layer is not correctly aligned with the target element.
Error Screenshot
Solution
By default, the getOffset function in Intro.js uses the element as the relative element for positioning the helping layer. However, this approach is problematic when a Chrome extension modifies the tag, for example, by adding a margin-top.
To resolve this issue, the function should prioritize the document.documentElement (i.e., the element) over the element. This ensures that the helping layer is positioned correctly, even when extensions or other scripts make layout changes to the tag.
Code Adjustment:
Update the getOffset function in the Intro.js code to use document.documentElement as the default relative element.