mortezaei 1 week ago
parent
commit
b8fc234697
  1. 13
      src/components/Componentes/use-sheet-scroll-lock.ts

13
src/components/Componentes/use-sheet-scroll-lock.ts

@ -104,16 +104,15 @@ function syncKeyboardShift(height: number) {
const activeContent = document.querySelector<HTMLElement>( const activeContent = document.querySelector<HTMLElement>(
'.question-snap-item[aria-current="step"] .question-snap-content', '.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( root.style.setProperty(
"--question-keyboard-shift", "--question-keyboard-shift",
`${Math.min(requiredShift, height)}px`,
`${requiredShift}px`,
); );
} }

Loading…
Cancel
Save