To their credit, Microsoft puts the cursor in the text field ready for me to type in my authenticator code. Most web sites I've found, do not. So I look up with my shiny new code, ready to start typing, realize I need to move my hand to the mouse, place the cursor into the field then there's a 50% change I've forgotten the code and have to look back at my phone.
A lot (the majority?) of web developers know their framework and how to script things but don't know that HTML has been able to do things like this out of the box for over a decade. Even IE 10 supported it. So much simpler and more reliable than using JavaScript.<p><pre><code> <input name="foo" type="text" autofocus>
</code></pre>
<a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/docs/Web/HTML/Global_att...</a>
(From <a href="https://github.com/sveltejs/svelte/issues/6629#issuecomment-898497953">https://github.com/sveltejs/svelte/issues/6629#issuecomment-...</a>) "The reason why autofocus should be generally avoided, is that it's messing up the focus order for screenreaders and similar assistive technologies. Additionally, logical "focus order" is also a success criterion on the official WCAG 2.0 accessibility guidelines by the W3C." <a href="https://www.w3.org/TR/UNDERSTANDING-WCAG20/navigation-mechanisms-focus-order.html" rel="nofollow noreferrer">https://www.w3.org/TR/UNDERSTANDING-WCAG20/navigation-mechan...</a>
Cynically, I feel like these details are often lost in the two-week sprint cycle or other realities of modern software development process. The Figma file didn't specify autofocus, the PM doesn't care about it, and the engineer just wants to close their ticket so they can move on to the next one. It's a login page, who cares? What revenue or business metric does it drive? Same reason the input field for the code doesn't have its input mode set to numeric (to show a numeric keyboard on mobile devices), and the same reason the email field doesn't have the email input mode set (to show the email input keyboard with @ and . prominently featured).
I can get over that, but I've used a couple of websites where hitting enter in the code box doesn't submit the code and log you in - that is unforgivable.
Principle of Least Astonishment<p>"In user interface design and software design,[1] the principle of least astonishment (POLA), also known as principle of least surprise,[a] proposes that a component of a system should behave in a way that most users will expect it to behave, and therefore not astonish or surprise users."<p><a href="https://en.wikipedia.org/wiki/Principle_of_least_astonishment" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Principle_of_least_astonishmen...</a><p>Such a feature would negatively affect accessibility, without some sort of accessible clue about where the cursor was moved.
Similar vein, there’s a special place In hell for web / iOS developers who don’t flag input fields correctly to allow autofill / password managers to work. I see it in a lot of crappy legacy iOS apps.
Even worse is when the input is initially has the cursor, but then the site's absolute genius SSR rehydration kicks in, not only erasing what you just typed, but also removing focus from the input.
a couple of reason not to focus:<p>1. on mobile devices, a focused <input> also triggers Keyboard to open, that in turn may cause the page/content to scroll suddenly etc. that could annoy the user,
2. if there's content to read (a message, Terms etc), the user may end up not fill the form at all
While I normally feel like the designers don't care about accessibility, I feel like in this case, it may be a bit of a security issue. The site wants to do all they can to foil automation, for example, and if the caret isn't helpfully placed exactly where they need to start input, a human can figure that out better than a bot.
The web is not designed to be useful for any purpose. It is designed to demonstrate plausible "technologies" developed by companies whose investors want to sell them to other companies.<p>Anything beyond basic WEB 1.0 is intended to be "plausible" instead of "useful."