Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3020: Fix unexpected scrolling behaviour in mobile desktop #3050

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { initSentry } from './utils/sentry'

const GlobalStyle = createGlobalStyle`
body {
position: relative;
steffenkleinle marked this conversation as resolved.
Show resolved Hide resolved

/* Styling for react-tooltip: https://react-tooltip.com/docs/getting-started#styling */
--rt-color-dark: ${props => props.theme.colors.textSecondaryColor};
--rt-color-white: ${props => props.theme.colors.backgroundColor};
Expand Down
13 changes: 10 additions & 3 deletions web/src/components/KebabMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ReactElement, ReactNode } from 'react'
import React, { ReactElement, ReactNode, useLayoutEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import styled from 'styled-components'

Expand Down Expand Up @@ -77,6 +77,13 @@ const StyledIcon = styled(Icon)`
const KebabMenu = ({ items, show, setShow, Footer }: KebabMenuProps): ReactElement | null => {
useLockedBody(show)
const { t } = useTranslation('layout')
const [scrollY, setScrollY] = useState<number>(0)

useLayoutEffect(() => {
if (show) {
setScrollY(window.scrollY)
}
}, [show])

const onClick = () => {
setShow(!show)
Expand All @@ -95,8 +102,8 @@ const KebabMenu = ({ items, show, setShow, Footer }: KebabMenuProps): ReactEleme
className='kebab-menu'
show={show}
style={{
visibility: show ? 'visible' : 'hidden',
top: window.scrollY > 0 ? `${window.scrollY}px` : undefined,
display: show ? 'block' : 'none',
top: scrollY > 0 ? `${scrollY}px` : undefined,
}}>
steffenkleinle marked this conversation as resolved.
Show resolved Hide resolved
{/* disabled because this is an overlay for backdrop close */}
{/* eslint-disable-next-line styled-components-a11y/no-static-element-interactions,styled-components-a11y/click-events-have-key-events */}
Expand Down
1 change: 1 addition & 0 deletions web/src/styles/KebabMenu.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
width: 100%;
height: 100%;
overflow: hidden;
z-index: 10;
}
Loading