few textfield improvements
This commit is contained in:
1 parent
0e65b8c446
commit
15ce86d6f3
3 files changed
+20
-2
No files matched your search
+18
-1
@@ -26,6 +26,7 @@ export default function Main() {
|
||||
|
||||
useEffect(() => {
|
||||
if (!hasAttachedListerner && step > 0) {
|
||||
setHasAttachedListener(true);
|
||||
const doFullscreen = () => {
|
||||
if (screenfull.isEnabled) {
|
||||
screenfull.request();
|
||||
@@ -34,7 +35,23 @@ export default function Main() {
|
||||
window.addEventListener("click", () => {
|
||||
doFullscreen();
|
||||
});
|
||||
setHasAttachedListener(true);
|
||||
if (window.visualViewport) {
|
||||
const handleResize = () => {
|
||||
const keyboardHeight = window.innerHeight - window.visualViewport.height;
|
||||
const appContainer = document.querySelector('#app');
|
||||
if (appContainer) {
|
||||
appContainer.style.paddingBottom = keyboardHeight > 0 ? `${keyboardHeight}px` : '0px';
|
||||
}
|
||||
|
||||
if (document.activeElement && keyboardHeight > 0) {
|
||||
document.activeElement.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
};
|
||||
|
||||
window.visualViewport.addEventListener('resize', handleResize);
|
||||
window.visualViewport.addEventListener('scroll', handleResize);
|
||||
}
|
||||
|
||||
doFullscreen();
|
||||
}
|
||||
}, [step, hasAttachedListerner, setHasAttachedListener]);
|
||||
|
||||
Reference in new issue
Block a user