diff --git a/src/components/Componentes/use-sheet-scroll-lock.ts b/src/components/Componentes/use-sheet-scroll-lock.ts index 1347dd9..cbd7dbf 100644 --- a/src/components/Componentes/use-sheet-scroll-lock.ts +++ b/src/components/Componentes/use-sheet-scroll-lock.ts @@ -104,16 +104,15 @@ function syncKeyboardShift(height: number) { const activeContent = document.querySelector( '.question-snap-item[aria-current="step"] .question-snap-content', ); - if (!activeContent) return; + const snapList = document.querySelector(".question-snap-list"); + if (!activeContent || !snapList) return; - const visibleBottom = window.innerHeight - height; - const requiredShift = Math.max( - 0, - activeContent.getBoundingClientRect().bottom - visibleBottom + 16, - ); + const contentTop = activeContent.getBoundingClientRect().top; + const targetTop = snapList.getBoundingClientRect().top + 8; + const requiredShift = Math.max(0, contentTop - targetTop); root.style.setProperty( "--question-keyboard-shift", - `${Math.min(requiredShift, height)}px`, + `${requiredShift}px`, ); }