diff --git a/passbook/flows/templates/flows/shell.html b/passbook/flows/templates/flows/shell.html index 0d1b1df3d..8957901b5 100644 --- a/passbook/flows/templates/flows/shell.html +++ b/passbook/flows/templates/flows/shell.html @@ -120,6 +120,7 @@ const updateCard = (data) => { break; case "template": flowBody.innerHTML = data.body; + checkAutofocus(); updateMessages(); loadFormCode(); setFormSubmitHandlers(); @@ -138,6 +139,12 @@ const loadFormCode = () => { document.head.appendChild(newScript); }); }; +const checkAutofocus = () => { + const autofocusElement = document.querySelector("#flow-body [autofocus]"); + if (autofocusElement !== null) { + autofocusElement.focus(); + } +}; const updateFormAction = (form) => { for (let index = 0; index < form.elements.length; index++) { const element = form.elements[index];