I am using custom policies for our sign-up/sign-in etc user flows. When navigating to the sign-up form in Chrome & Edge, the form displays scrolled part-way down the screen. I believe this is because the lowest input field (a check-box) has an autofocus
attribute, i.e.:
<input name="xxx" id="xxx" autofocus="" type="checkbox" value="True" />
I can verify that the lowest input (the checkbox) has focus as when I press the space-bar, it toggles.
It appears that Microsoft's javascript in the page is dynamically setting this autofocus attribute. Searching through the javascript it looks like every input has an AUTOFOCUS=True
property:
{
"USER_INPUT_TYPE": "CheckboxMultiSelect",
"IS_TEXT": false,
"IS_EMAIL": false,
...
"OPTIONS": [{
"DISP": "I agree.",
"VAL": "True",
"PRESEL": false,
-->> "AUTOFOCUS": true <<--
}
]
}
Is there any way to change this autofocus behaviour? Currently it is very annoying as it means that Chrome users see the bottom half of the form when the page loads.
I think this is essentially answered as JavaScript is now available for use on custom pages.
https://azure.microsoft.com/en-au/resources/samples/active-directory-b2c-javascript-msal-singlepageapp/
I'd suggest using JQuery to deselect the input element or remove the tab index value after rendering, but there are a myriad of options now available.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With