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:
Linus Flood
2025-11-14 09:51:29 +00:00
parent 289adfe98b
commit 3d121be74a
4 changed files with 7 additions and 58 deletions

View File

@@ -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"