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

Decide where visible focus should go after selecting a file #4412

Closed
1 of 3 tasks
Tracked by #4242
selfthinker opened this issue Jan 8, 2025 · 1 comment
Closed
1 of 3 tasks
Tracked by #4242

Decide where visible focus should go after selecting a file #4412

selfthinker opened this issue Jan 8, 2025 · 1 comment
Assignees

Comments

@selfthinker
Copy link
Contributor

selfthinker commented Jan 8, 2025

What

Our prototype currently behaves differently to a native field when it comes to what is focused after selecting a file.
It makes sense to focus on something visible.

The native element has the focus around the button and the file name:
native (description above)

There is no visible focus in the prototype version:
prototype (description above)

We need to decide where the focus should go. The options are:

  • the button
  • an area around the button and the file name (similar to the native element)
  • somewhere else?

Why

We should make our implementation as consistent with the native behaviour as possible.
Unless we think we can improve the behaviour (in a way that isn't unexpected).

Who needs to work on this

Accessibility specialist, designer

Who needs to review this

We'll review the decision as a team in a decision log meeting

Done when

  • Options with their pros and cons documented
  • Researched what other implementations do
  • Decision made and logged
@selfthinker selfthinker changed the title Review whether focus is needed when file is uploaded [Anika to create issue] Decide where visible focus should go after selecting a file Jan 8, 2025
@selfthinker selfthinker moved this to Backlog 🏃🏼‍♀️ in GOV.UK Design System cycle board Jan 8, 2025
@selfthinker selfthinker moved this from Backlog 🏃🏼‍♀️ to In progress 📝 in GOV.UK Design System cycle board Jan 14, 2025
@selfthinker
Copy link
Contributor Author

I'd recommend to put the programmatic and visual focus back onto the button after a file has been selected.

Putting the focus back onto the element that triggered the focus to be moved away is general best practice.
This would go against trying to make our new component behave as much as possible like the native element. But focusing on an area around the button and the feedback area (like a native element does) would make this more complex and potentially confusing.

We had discussed this in a meeting yesterday. We mostly agreed, although putting the focus onto an area around the button and feedback area was also discussed.

Another thing I only realised after our discussion is that with the native element the focus before selecting a file is on the same as the focus after selecting a file. So, by keeping it on the button in our new implementation, we're following the same pattern. Although, if we wanted to move the focus to the whole area and also follow that same pattern, we should do that when simply tabbing to it as well. But I don't think that makes sense (for the same reasons mentioned above).

I'll close this now as the decision has been made.
But we need to be flexible enough to change this decision if it turns out there is a reason which we don't foresee yet.

@selfthinker selfthinker moved this from In progress 📝 to Needs review 🔍 in GOV.UK Design System cycle board Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Needs review 🔍
Development

No branches or pull requests

2 participants