Skip to content

Commit

Permalink
fix product-tour on firefox (#1632)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamespohalloran authored Jul 30, 2023
1 parent 9a606de commit 0fb1649
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions pages/docs/product-tour.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,24 @@ export default function Page(props) {
if (!activeIds.length) {
return
}
const imageSrc = (
document.querySelector(
`h2#${activeIds[0]} ~ *:has(img) img, ` +
`h3#${activeIds[0]} ~ *:has(img) img, ` +
`h4#${activeIds[0]} ~ *:has(img) img`
) as any
)?.src

const heading = document.querySelector(
`h2#${activeIds[0]}, h3#${activeIds[0]}, h4#${activeIds[0]}`
)
let imageSrc = null

if (heading) {
let sibling = heading.nextElementSibling

while (sibling) {
const image = sibling.querySelector('img')
if (image) {
imageSrc = image.src
break
}
sibling = sibling.nextElementSibling
}
}

// limit activeIds to 1
const deepestActiveIds = activeIds.slice(0, 1)
Expand Down

1 comment on commit 0fb1649

@vercel
Copy link

@vercel vercel bot commented on 0fb1649 Jul 30, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

tina-io – ./

tina-io-tinacms.vercel.app
tina-io-git-master-tinacms.vercel.app
tina.io

Please sign in to comment.