Skip to content

Commit 46c1700

Browse files
committed
fix: apply feedback on Go to top button [Fixes #15412]
1 parent 784e8ad commit 46c1700

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/components/Footer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ const Footer = ({ lastDeployLocaleTimestamp }: FooterProps) => {
320320
<Button
321321
variant="outline"
322322
isSecondary
323-
onClick={() => scrollIntoView("top")}
323+
onClick={() => scrollIntoView("div.mx-auto")}
324324
>
325325
<IoChevronUpSharp /> Go to top
326326
</Button>

src/components/ui/buttons/Button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
105105
ref
106106
) => {
107107
const handleOnClick = (e: React.MouseEvent<HTMLButtonElement>) => {
108-
toId && scrollIntoView(toId)
108+
toId && scrollIntoView("#" + toId)
109109
customEventOptions && trackCustomEvent(customEventOptions)
110110

111111
onClick?.(e)

src/layouts/BaseLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const BaseLayout = ({
5151
* layout on initial load.
5252
*/}
5353
<SkipLink />
54-
<div className="mx-auto max-w-screen-2xl" id="top">
54+
<div className="mx-auto max-w-screen-2xl">
5555
<Nav />
5656

5757
{/* TODO: FIX TRANSLATION BANNER LOGIC FOR https://github.com/ethereum/ethereum-org-website/issues/11305 */}

src/lib/utils/scrollIntoView.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
export const scrollIntoView = (
2-
toId: string,
2+
selector: string,
33
options: ScrollIntoViewOptions = { behavior: "smooth", block: "start" }
44
): void => {
5-
const element = document.getElementById(toId)
5+
const element = document.querySelector(selector)
66

77
if (!element) return
88

0 commit comments

Comments
 (0)