|
|
|
@ -104,16 +104,15 @@ function syncKeyboardShift(height: number) { |
|
|
|
const activeContent = document.querySelector<HTMLElement>( |
|
|
|
'.question-snap-item[aria-current="step"] .question-snap-content', |
|
|
|
); |
|
|
|
if (!activeContent) return; |
|
|
|
const snapList = document.querySelector<HTMLElement>(".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`, |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
|