Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix helping layer position #2084

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TechSavvvyyy
Copy link

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
Screenshot 2025-01-10 at 2:41 PM

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.

Copy link

vercel bot commented Jan 10, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
intro-js ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 10, 2025 9:16am

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.

1 participant