Merged in feat/book-570-select-rate-scroll (pull request #3160)
feat(BOOK-570): fix scroll issue when selecting a rate for the first time * feat(BOOK-570): fix scroll issue when selecting a rate for the first time Approved-by: Joakim Jäderberg
This commit is contained in:
@@ -19,7 +19,9 @@ import styles from "./mobileSummary.module.css"
|
||||
export function MobileSummary() {
|
||||
const intl = useIntl()
|
||||
const scrollY = useRef(0)
|
||||
const [isSummaryOpen, setIsSummaryOpen] = useState(false)
|
||||
const [isSummaryOpen, setIsSummaryOpen] = useState<boolean | undefined>(
|
||||
undefined
|
||||
)
|
||||
const isUserLoggedIn = useIsLoggedIn()
|
||||
|
||||
const { selectedRates } = useSelectRateContext()
|
||||
@@ -29,6 +31,10 @@ export function MobileSummary() {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (isSummaryOpen === undefined) {
|
||||
return
|
||||
}
|
||||
|
||||
if (isSummaryOpen) {
|
||||
scrollY.current = window.scrollY
|
||||
document.body.style.position = "fixed"
|
||||
|
||||
Reference in New Issue
Block a user