Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

fix(autocomplete): change md-escape-options default to 'clear' #11988

Merged
merged 1 commit into from
Jul 31, 2020

Conversation

Splaktar
Copy link
Contributor

PR Checklist

Please check that your PR fulfills the following requirements:

  • The commit message follows our guidelines
  • Tests for the changes have been added or this is not a bug fix / enhancement
  • Docs have been added, updated, or were not required

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Enhancement
[ ] Documentation content changes
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Infrastructure changes
[ ] Other... Please describe:

What is the current behavior?

  • the default is 'blur clear'
  • this causes some a11y challenges as users get sent to the <body> in Chrome after Escape is pressed while having an md-autocomplete options panel open. Most screen reader users just want the panel to dismiss, they don't want their focus to be sent to the body as that may cause them to need to re-navigate the whole page again.

Issue Number:
Fixes #11767

What is the new behavior?

  • md-escape-options defaults to 'clear'
  • clean up tests, remove unused injections, variables, missing spaces, semi-colons

Does this PR introduce a breaking change?

[x] Yes
[ ] No

BREAKING CHANGE: The default behavior of md-autocomplete, when the options panel is visible and the Escape key is pressed, has changed. md-escape-options now defaults to 'clear' instead of 'blur clear'. This better aligns with the WAI-ARIA Authoring Practices as the focus is not sent to another element (like the <body>) when the Escape key is pressed.

If you want to restore the previous behavior, add the following to your md-autocomplete components:

md-escape-options="blur clear"

Other information

- previously the default was `'blur clear'`
- clean up tests, remove unused injections, variables, missing spaces, semi-colons

Fixes #11767

BREAKING CHANGE: The default behavior of `md-autocomplete`, when the options panel is visible and the Escape key is pressed, has changed. `md-escape-options` now defaults to `'clear'` instead of `'blur clear'`. This better aligns with the [WAI-ARIA Authoring Practices](https://www.w3.org/TR/wai-aria-practices/examples/combobox/aria1.0pattern/combobox-autocomplete-list.html) as the focus is not sent to another element (like the `<body>`) when the Escape key is pressed.

If you want to restore the previous behavior, add the following to your `md-autocomplete` components:
```html
md-escape-options="blur clear"
```
@googlebot googlebot added the cla: yes PR author has signed Google's CLA: https://opensource.google.com/docs/cla/ label Jul 30, 2020
@Splaktar Splaktar added this to the 1.2.0 milestone Jul 30, 2020
@Splaktar Splaktar self-assigned this Jul 30, 2020
@Splaktar Splaktar requested a review from mmalerba July 30, 2020 20:50
@Splaktar Splaktar added a11y This issue is related to accessibility P3: important Important issues that really should be fixed when possible. type: bug pr: merge ready This PR is ready for a caretaker to review labels Jul 30, 2020
Copy link
Contributor

@mmalerba mmalerba left a comment

Choose a reason for hiding this comment

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

LGTM

@Splaktar Splaktar merged commit 47106ba into master Jul 31, 2020
@Splaktar Splaktar deleted the autocomplete-change-escape-options-default branch July 31, 2020 00:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a11y This issue is related to accessibility cla: yes PR author has signed Google's CLA: https://opensource.google.com/docs/cla/ P3: important Important issues that really should be fixed when possible. pr: merge ready This PR is ready for a caretaker to review type: bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

autocomplete: change md-escape-options default to 'clear'
3 participants