Skip to content

Commit

Permalink
Merge pull request #32162 from github/repo-sync
Browse files Browse the repository at this point in the history
Repo sync
  • Loading branch information
docs-bot authored Mar 20, 2024
2 parents 6046d44 + fa5ec4c commit 177a2cd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/events/components/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,17 @@ function initLinkEvent() {
link_container: container?.dataset.container,
})
})

// Add tracking for scroll to top button
document.documentElement.addEventListener('click', (evt) => {
const target = evt.target as HTMLElement
if (!target.closest('.ghd-scroll-to-top')) return
const url = window.location.href.split('#')[0] // Remove hash
sendEvent({
type: EventType.link,
link_url: `${url}#scroll-to-top`,
})
})
}

function initHoverEvent() {
Expand Down
1 change: 1 addition & 0 deletions src/frame/components/ui/ScrollButton/ScrollButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const ScrollButton = ({ className, ariaLabel }: ScrollButtonPropsT) => {
<button
onClick={onClick}
className={cx(
'ghd-scroll-to-top', // for data tracking, see events.ts
'tooltipped tooltipped-n tooltipped-no-delay color-bg-accent-emphasis color-fg-on-emphasis circle border-0',
'd-flex flex-items-center flex-justify-center',
)}
Expand Down

0 comments on commit 177a2cd

Please sign in to comment.