Skip to content

Picking a select option with the mouse moves focus out of the select #4256

Closed

Description

@AlexAndBear

Initial Checklist

  • I understand this is a bug report and questions should be posted in the Community Discussions
  • I searched issues and couldn’t find anything (or linked relevant results below)

Bug Description

When you pick an option in an OcSelect with the mouse, focus leaves the select and ends up on <body>. Picking with the keyboard (Enter) keeps focus in the select, because OcSelect puts it back on the search input, but the mouse pick doesn't: vue-select blurs the input after a pick and nothing refocuses it.

That's an accessibility problem (WCAG 2.4.3 Focus Order): screen readers in browse mode activate options with a click, so their users lose their place in the form after every pick. It also breaks keyboard shortcuts: with focus on <body>, the next Esc goes to the page-level shortcuts instead of the select. In "Edit user" in the admin settings, that Esc clears the user selection and closes the edit panel, and all unsaved changes are lost without a warning.

Reproduction Steps

  1. Admin settings > Users: edit a user
  2. Change the name
  3. Open the role dropdown with the mouse and click another role
  4. Press Esc

Expected Outcome

Focus stays in the select after a mouse pick, the same as after a keyboard pick. Esc doesn't close the panel, and the changes are kept.

Actual Outcome

Focus is on <body> after step 3. Esc clears the selection, the edit panel closes and the name change is lost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions