diff --git a/packages/booking-flow/lib/components/SelectRate/RoomsContainer/Rooms/RoomsList/ScrollToList.tsx b/packages/booking-flow/lib/components/SelectRate/RoomsContainer/Rooms/RoomsList/ScrollToList.tsx index c854def2b..a56723287 100644 --- a/packages/booking-flow/lib/components/SelectRate/RoomsContainer/Rooms/RoomsList/ScrollToList.tsx +++ b/packages/booking-flow/lib/components/SelectRate/RoomsContainer/Rooms/RoomsList/ScrollToList.tsx @@ -28,10 +28,12 @@ export default function ScrollToList() { requestAnimationFrame(() => { const SCROLL_OFFSET = 173 // summary on mobile is 163px - const selectedRateCard: HTMLElement | null = document.querySelector( - `.${styles.roomList} label:has(input[type=radio]:checked)` + const checkedRadio = document.querySelector( + `.${styles.roomList} input[type="radio"]:checked` ) + const selectedRateCard = checkedRadio?.closest("label") ?? null + if (selectedRateCard) { const elementPosition = selectedRateCard.getBoundingClientRect().top const windowHeight = window.innerHeight