Skip to content

Commit

Permalink
fix: impored scroll margins
Browse files Browse the repository at this point in the history
  • Loading branch information
heydoyouknowme0 committed Apr 28, 2024
1 parent 09bc981 commit 13cf9f7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/[locale]/student-activities/scroll-aware-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const ScrollAwareSection = ({
location: string;
}) => {
const { ref } = useIntersectionObserver({
threshold: 0.5,
rootMargin: '0px 0px -90% 0px',
threshold: 0.1,
onChange: (isIntersecting) => {
if (!isIntersecting) return;
window.history.replaceState(null, '', `#${location}`);
Expand Down
8 changes: 7 additions & 1 deletion components/scrolling-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ const ScrollingNav = ({
variant="ghost"
active={hash === href}
>
<Link href={href} onClick={() => setHash(href)}>
<Link
href={href}
onClick={(event) => {
(event.target as HTMLButtonElement).blur(); // to be removed, focus styles overrides both active and normal styles on the button causing visual bug
setHash(href);
}}
>
{label}
</Link>
</Button>
Expand Down

0 comments on commit 13cf9f7

Please sign in to comment.