Fix: iOS Modal scrollIntoView bei Tastatur; CSV Stornierte mit 0€ + Stornonummer (SW by-v975)
This commit is contained in:
parent
2bbf3bc3f6
commit
cabb2fd6f7
6 changed files with 38 additions and 19 deletions
|
|
@ -83,7 +83,7 @@ const UI = (() => {
|
|||
document.getElementById('modal-container').appendChild(overlay);
|
||||
document.documentElement.classList.add('modal-open');
|
||||
|
||||
// Tastatur auf Mobilgeräten: Modal nach oben schieben wenn Keyboard erscheint
|
||||
// Tastatur auf Mobilgeräten: Modal nach oben schieben + fokussiertes Feld einblenden
|
||||
let _vvCleanup = null;
|
||||
const vv = window.visualViewport;
|
||||
if (vv) {
|
||||
|
|
@ -100,16 +100,26 @@ const UI = (() => {
|
|||
};
|
||||
}
|
||||
|
||||
_current = { overlay, onClose, _vvCleanup };
|
||||
// Fokussiertes Feld in den sichtbaren Bereich scrollen (iOS)
|
||||
const _onFocusin = e => {
|
||||
const el = e.target;
|
||||
if (el.tagName === 'INPUT' || el.tagName === 'TEXTAREA' || el.tagName === 'SELECT') {
|
||||
setTimeout(() => el.scrollIntoView({ block: 'nearest', behavior: 'smooth' }), 320);
|
||||
}
|
||||
};
|
||||
overlay.addEventListener('focusin', _onFocusin);
|
||||
|
||||
_current = { overlay, onClose, _vvCleanup, _onFocusin };
|
||||
|
||||
return overlay.querySelector('.modal');
|
||||
}
|
||||
|
||||
function close() {
|
||||
if (!_current) return;
|
||||
const { onClose, _vvCleanup } = _current;
|
||||
const { onClose, _vvCleanup, _onFocusin } = _current;
|
||||
onClose?.();
|
||||
_vvCleanup?.();
|
||||
if (_onFocusin) _current.overlay.removeEventListener('focusin', _onFocusin);
|
||||
_current.overlay.remove();
|
||||
document.documentElement.classList.remove('modal-open');
|
||||
_current = null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue