fix focus on ticket new, sitebranding, customer edit error
This commit is contained in:
1 parent
d72381f0ac
commit
6b841dc5fa
11 files changed
+139
-10
No files matched your search
@@ -349,6 +349,19 @@
|
||||
setupVoiceRecorder(voiceRoot);
|
||||
form.dataset.wizardEnhanced = '';
|
||||
|
||||
function focusWizardCard() {
|
||||
requestAnimationFrame(() => {
|
||||
// Do not steal focus if the visitor has already started interacting.
|
||||
if (document.activeElement !== document.body && document.activeElement !== document.documentElement) return;
|
||||
form.focus({ preventScroll: true });
|
||||
form.scrollIntoView({
|
||||
behavior: window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 'auto' : 'smooth',
|
||||
block: 'start',
|
||||
inline: 'nearest',
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
const serverErrorStep = steps.find(step => step.querySelector('.errorlist'));
|
||||
const initialStep = serverErrorStep ? Number(serverErrorStep.dataset.wizardStep) : 1;
|
||||
showStep(initialStep, { scroll: false });
|
||||
@@ -359,5 +372,5 @@
|
||||
.filter(Boolean);
|
||||
const number = Number(serverErrorStep.dataset.wizardStep);
|
||||
requestAnimationFrame(() => showValidation(number, { message: messages.join(' '), fields }));
|
||||
}
|
||||
} else focusWizardCard();
|
||||
})();
|
||||
Reference in new issue
Block a user