Skip to content

Commit

Permalink
fix: scroll locked after sign out (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
braianj authored Jan 2, 2025
1 parent bbfaf4c commit 317a441
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions src/components/UserMenu/UserMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { ManaBalancesProps } from "./ManaBalances"
import { i18n as i18nUserMenu } from "./UserMenu.i18n"
import { UserMenuSignedIn } from "./UserMenuSignedIn/UserMenuSignedIn"
import { config } from "../../config"
import { useTabletAndBelowMediaQuery } from "../Media"
import { UserMenuEventId, UserMenuProps } from "./UserMenu.types"
import {
DownloadLink,
Expand All @@ -31,8 +30,6 @@ const UserMenu = React.memo((props: UserMenuProps) => {
...signInProps
} = props

const isTabletAndBelow = useTabletAndBelowMediaQuery()

const [isOpen, setIsOpen] = useState(false)
const [trackingId, setTrackingId] = useState<string | undefined>(undefined)
const handleToggle = useCallback(
Expand All @@ -45,14 +42,6 @@ const UserMenu = React.memo((props: UserMenuProps) => {
if (!prev && onClickOpen) {
onClickOpen(event, trackId)
}

if (isTabletAndBelow && !prev) {
window.addEventListener("scroll", noScroll)
}

if (isTabletAndBelow && prev) {
window.removeEventListener("scroll", noScroll)
}
return !prev
})
},
Expand All @@ -61,9 +50,6 @@ const UserMenu = React.memo((props: UserMenuProps) => {

const handleClose = useCallback(() => {
setIsOpen(false)
if (isTabletAndBelow) {
window.removeEventListener("scroll", noScroll)
}
}, [setIsOpen])

const handleClickDownload = useCallback(
Expand Down Expand Up @@ -174,8 +160,4 @@ const UserMenu = React.memo((props: UserMenuProps) => {
)
})

function noScroll() {
window.scrollTo(0, 0)
}

export { UserMenu }

0 comments on commit 317a441

Please sign in to comment.