Merged in feat/book-395-queryselector (pull request #2870)

feat(BOOK-395): fixed error in queryselector

* feat(BOOK-395): fixed error in queryselector


Approved-by: Anton Gunnarsson
This commit is contained in:
Linus Flood
2025-09-26 10:17:28 +00:00
parent f2a5fc03c2
commit 2f1512edaa

View File

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