Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KEYCLOAK-19731: Make password field autofocus on login form, fixes #10027 #8681

Merged
merged 1 commit into from
Apr 22, 2022

Conversation

d2a-raudenaerde
Copy link
Contributor

@d2a-raudenaerde d2a-raudenaerde commented Nov 2, 2021

As user I would like to be able to directly type my password in a flow where I have a username form, followed by a password form. fixes #10027

Copy link

@MPParsley MPParsley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like this feature but note that there's an accessibility implication when you send users to a part of a page without context.

See https://medium.com/@gavyn/til-autofocus-inputs-are-an-accessibility-problem-32ced60c3109

mabartos
mabartos previously approved these changes Nov 3, 2021
@ahus1
Copy link
Contributor

ahus1 commented Mar 17, 2022

With the listed resources about accessibility I close this issue. @ssilvert - as you're the one involved with UIs, please feel free to intervene and override.

If there is additional evidence from accessibility resources, please provide them here to re-open the issue.

@ahus1 ahus1 closed this Mar 17, 2022
@ssilvert
Copy link
Contributor

@ahus1 I think this was the right decision.

@mabartos
Copy link
Contributor

mabartos commented Apr 4, 2022

I really like this feature but note that there's an accessibility implication when you send users to a part of a page without context.

See https://medium.com/@gavyn/til-autofocus-inputs-are-an-accessibility-problem-32ced60c3109

As @tspearconquest mentioned in #10027 related this article:


From reading through the linked article and its source (Bruce Lawson's blog post from 2011) the point was made that autofocus is an accessiblity issue for screen readers when there is no context.

In the case of Keycloak, the context is already in the flow and is supplied by the user.

Apologies but I'm not clear how the password field being autofocused is an accessibility related issue when we consider the 2 points below:

  1. The previous page in the flow (where user enters their Email and clicks on Sign in) had done the same thing by autofocusing on the email input

  2. The context is supplied when the user clicks Sign In after entering their username. They are being taken to a page which only contains a password form. The context is that the page is a password input field to go with the username input they just submitted.


I agree with those points. The context is known in the case of the login password page. The type of the text input on that page is password and also there's present a label for the password, which is (AFAIK) read by screen readers after focusing on the related input box. It's well described in this article[1]. This approach is also used in Google Sign-in.

I think this issue should be opened.
@ssilvert @ahus1 WDYT?

[1] https://www.a11y-101.com/development/inputs

Some related discussions:
https://stackoverflow.com/questions/2180645/is-automatically-assigning-focus-bad-for-accessibility
https://stackoverflow.com/questions/32291283/does-the-autofocus-form-attribute-violate-accessibility-standards

@mabartos
Copy link
Contributor

Opened again, because I think it's a relevant issue, which could be solved. See the comment ^^ above.

@ssilvert Could you please check this PR once again? Thank you.

@mabartos mabartos reopened this Apr 11, 2022
@mabartos
Copy link
Contributor

@d2a-raudenaerde Could you please create a GH issue for this and link the issue number to the commit description? Or you can link this PR with issue #10027. Thank you.

@ahus1
Copy link
Contributor

ahus1 commented Apr 11, 2022

@mabartos - thank you for this additional input and re-opening it. Thinking about this from a "context" angle might make it work.

@d2a-raudenaerde
Copy link
Contributor Author

See also: #10027

@d2a-raudenaerde d2a-raudenaerde changed the title KEYCLOAK-19731: Make password field autofocus on login form KEYCLOAK-19731: Make password field autofocus on login form, fixes #10027 Apr 11, 2022
@mabartos
Copy link
Contributor

@d2a-raudenaerde Please update the commit message, not the PR title. Sth like this: git commit -m "Make password field autofocus" -m "Closes #10027". Thank you

@ssilvert
Copy link
Contributor

Opened again, because I think it's a relevant issue, which could be solved. See the comment ^^ above.

@ssilvert Could you please check this PR once again? Thank you.

I don't have any particular expertise in the area of screen readers. If you guys conclude that it's really not an issue then I'm fine with it.

Also, the UI team is not yet in charge of the login theme, so it's really not my call.

@mabartos
Copy link
Contributor

mabartos commented Apr 14, 2022

I can confirm that everything's working as expected from my POV. I tried to test it with 'axe DevTools - Web Accessibility Testing' tool and 'Screen reader' extension provided by Chrome itself.

@d2a-raudenaerde Could you please update the commit message?

@mabartos
Copy link
Contributor

@d2a-raudenaerde Please, squash these commits and provide a correct commit message with a commit description mentioned above.

Hint: You can amend the commit

git commit --amend

and then edit the commit message as follows:

Make password field autofocus on login form

Closes #10027

@ahus1 ahus1 self-requested a review April 20, 2022 10:24
ahus1
ahus1 previously approved these changes Apr 20, 2022
Copy link
Contributor

@ahus1 ahus1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ready to be merged as long as it is being squashed on merge.

@ahus1
Copy link
Contributor

ahus1 commented Apr 20, 2022

@d2a-raudenaerde - thanks for updating the commit as @mabartos asked you to. One step that didn't work out: the changes then need to be force-pushed to the branch of the pull request. Without that, this PR still lists 5 commits, when it should show only one (see screen shot below).

image

@ahus1
Copy link
Contributor

ahus1 commented Apr 20, 2022

@d2a-raudenaerde - force-push, well done! I'll re-open the PR!

@ahus1 ahus1 reopened this Apr 20, 2022
@ahus1 ahus1 self-requested a review April 20, 2022 13:38
@ahus1 ahus1 added status/ready Ready to be merged kind/enhancement Categorizes a PR related to an enhancement labels Apr 20, 2022
@stianst stianst merged commit ef4c057 into keycloak:main Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core kind/enhancement Categorizes a PR related to an enhancement status/ready Ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Focus on the password field when using separate pages for username and password
6 participants