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

Conversation

MarcoZehe
Copy link
Contributor

… reader users

  • make the nav-bar component a tablist.
  • make the nav-item's li element presentational and the button a tab.
  • apply the aria-label, if provided, to the button directly, not the li element.

Fixes #11485

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?

Issue Number: #11485

Currently, the nav-bar element is exposed as a listbox accessible to screen reader users. Its nav-item child consists of a li element which currently has role "option" (as appropriate for a listbox child), and the button inside that li is exposed as is.

Screen readers do have a hard time interacting with this construct, since they do not expect an option to contain a button.

What is the new behavior?

The new behavior is that the nav-bar element is exposed as a tablist, and the button inside the li of the nav-item as a tab accessible. In addition, the aria-label that was originally applied to the nav-item's li element is now applied to the buton, since the li in the tablist/tab pattern is to be marked presentational. aria-label must therefore go onto the element that has role "tab".

No changes besides semantic ARIA exposure has been changed, the keyboard behavior is the same as well as any other behavior this component exposes. Web developers needn't change anything, either.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

The tests have been adjusted to look for the aria-label on the tab directly, not the parent.

@googlebot googlebot added the cla: yes PR author has signed Google's CLA: https://opensource.google.com/docs/cla/ label Oct 14, 2018
@Splaktar
Copy link
Contributor

The build failure looks like a fluke. I have restarted it.

@Splaktar Splaktar self-requested a review October 16, 2018 02:53
@Splaktar Splaktar self-assigned this Oct 16, 2018
@Splaktar Splaktar added this to the 1.1.11 milestone Oct 16, 2018
@Splaktar Splaktar added type: bug a11y This issue is related to accessibility P1: urgent Urgent issues that should be addressed in the next minor or patch release. needs: review This PR is waiting on review from the team labels Oct 16, 2018
@Splaktar
Copy link
Contributor

It looks like the test failures are not a fluke as they keep happening and I can reproduce them on my local machine. Are you able to get all of the tests to pass on your local machine with gulp karma?

@Splaktar Splaktar added the in progress Mainly for in progress PRs, but may be used for issues that require multiple PRs label Oct 16, 2018
Copy link
Contributor

@Splaktar Splaktar left a comment

Choose a reason for hiding this comment

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

This looks good to me and passed manual testing on VoiceOver. Can you please update the API docs as mentioned below?

The test failures don't appear to be related to this PR. It appears that the tests in master are now broken after 12 days in which no commits occured... I'm still investigating if it has something to do with NodeJS 10.12.0 being released or some other dependency.

@Splaktar Splaktar removed the needs: review This PR is waiting on review from the team label Oct 16, 2018
@Splaktar
Copy link
Contributor

I've opened #11487 to track the test failures on master.

@MarcoZehe
Copy link
Contributor Author

@Splaktar Thanks for the review! I also changed the documentation further up to point to the tablist and tab specifications instead of the outdated site navigator pattern.

Copy link
Contributor

@Splaktar Splaktar left a comment

Choose a reason for hiding this comment

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

LGTM.

However, I don't see the changes where you mentioned updating the links to the tablist spec instead of the listbox spec. Did you forget to push that update?

@Splaktar
Copy link
Contributor

I've tracked down the CI failure and the disconnection issue to this test.

Splaktar added a commit that referenced this pull request Oct 17, 2018
fix closure properties to better represent the existing code
pin the version of jasmine-core since we don't support 2.99.1 yet
slightly improve the tone of the exceptions
pull in some karma configuration tweaks from Angular Material

Relates to #11485. Relates to #11486. Fixes #11487.
@Splaktar
Copy link
Contributor

I've opened PR #11488 to fix the test issues here. Sorry that you had to run into them!

@MarcoZehe
Copy link
Contributor Author

I've opened PR #11488 to fix the test issues here. Sorry that you had to run into them!

Thank you for this, and for your patience and guidance with my PR! I think I've addressed all your comments and will push an updated revision in a minute.

mmalerba pushed a commit that referenced this pull request Oct 24, 2018
…11488)

<!-- 
Filling out this template is required! Do not delete it when submitting a Pull Request! Without this information, your Pull Request may be auto-closed.
-->
## PR Checklist
Please check that your PR fulfills the following requirements:
- [x] The commit message follows [our guidelines](https://github.com/angular/material/blob/master/.github/CONTRIBUTING.md#-commit-message-format)
- [x] Tests for the changes have been added or this is not a bug fix / enhancement
- [x] Docs have been added, updated, or were not required

## PR Type
What kind of change does this PR introduce?
<!-- Please check the one that applies to this PR using "x". -->
```
[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?
- A new `npm i` may pick up `jasmine-core@2.99.1` which will cause many test failures since we don't currently support that version.
- Setting `md-nav-href=""` on an `md-nav-item` doesn't apply the proper `ng-href=""` because of a bad `if` check.
- The docs indicate that a navigation attribute **must** be defined on each `md-nav-item`, but the code doesn't throw an exception if this occurs. This can lead to unexpected behaviors like infinite loops or hanging async tasks.
- The Closure properties are incorrect in a number of cases.

<!-- Please describe the current behavior that you are modifying and link to one or more relevant issues. -->
Issue Number: 
Relates to #11485. Relates to #11486. Fixes #11487.

## What is the new behavior?

- set ng-href on nav-item even if md-nav-href is empty
- fix closure properties to better represent the existing code
- pin the version of jasmine-core since we don't support 2.99.1 yet
- slightly improve the tone of the exceptions
- pull in some karma configuration tweaks from Angular Material

## Does this PR introduce a breaking change?
```
[ ] Yes
[x] No
```
<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->
<!-- Note that breaking changes are highly unlikely to get merged to master unless the validation is clear and the use case is critical. -->

## Other information
@Splaktar
Copy link
Contributor

@MarcoZehe OK, PR #11488 has been merged. Can you please rebase this and then force push to your branch? That should hopefully get all of the tests passing in TravisCI. Thank you!

@MarcoZehe
Copy link
Contributor Author

@MarcoZehe OK, PR #11488 has been merged. Can you please rebase this and then force push to your branch? That should hopefully get all of the tests passing in TravisCI. Thank you!

Yes, all passed! -O-/

@Splaktar Splaktar added pr: merge ready This PR is ready for a caretaker to review and removed in progress Mainly for in progress PRs, but may be used for issues that require multiple PRs labels Oct 25, 2018
@Splaktar Splaktar assigned mmalerba and unassigned Splaktar Oct 25, 2018
@Splaktar Splaktar changed the title fix(nav-bar): expose nav-bar as tablist and nav-item as tab to screen… fix(nav-bar): improve screen reader support Oct 25, 2018
@Splaktar
Copy link
Contributor

The first line of your commit is a bit too long. Can you please update it to just be "fix(nav-bar): improve screen reader support"? Thanks!

* make the nav-bar component a tablist.
* make the nav-item's li element presentational and the button a tab.
* apply the aria-label, if provided, to the button directly, not the li element.

Fixes #11485
@MarcoZehe
Copy link
Contributor Author

The first line of your commit is a bit too long. Can you please update it to just be "fix(nav-bar): improve screen reader support"? Thanks!

Done. :) Thank you again for your patience and guidance!

@Splaktar
Copy link
Contributor

Looks good, thank you! I'll let you know if we run into any issues in the "presubmit" process. This will run the change through all of the relevant tests in Google to make sure that it passes unit tests, screenshot tests, and a11y tests.

@Splaktar
Copy link
Contributor

I've submitted PR #11494 which should improve the a11y state of nav-bar quite a bit more. I tested it with the changes in this PR and it worked well and doesn't seem to conflict.

@mmalerba mmalerba merged commit 6b29548 into angular:master Oct 26, 2018
@MarcoZehe MarcoZehe deleted the i11485 branch October 27, 2018 05:45
marosoft pushed a commit to marosoft/material that referenced this pull request Nov 11, 2018
…ngular#11488)

<!-- 
Filling out this template is required! Do not delete it when submitting a Pull Request! Without this information, your Pull Request may be auto-closed.
-->
## PR Checklist
Please check that your PR fulfills the following requirements:
- [x] The commit message follows [our guidelines](https://github.com/angular/material/blob/master/.github/CONTRIBUTING.md#-commit-message-format)
- [x] Tests for the changes have been added or this is not a bug fix / enhancement
- [x] Docs have been added, updated, or were not required

## PR Type
What kind of change does this PR introduce?
<!-- Please check the one that applies to this PR using "x". -->
```
[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?
- A new `npm i` may pick up `jasmine-core@2.99.1` which will cause many test failures since we don't currently support that version.
- Setting `md-nav-href=""` on an `md-nav-item` doesn't apply the proper `ng-href=""` because of a bad `if` check.
- The docs indicate that a navigation attribute **must** be defined on each `md-nav-item`, but the code doesn't throw an exception if this occurs. This can lead to unexpected behaviors like infinite loops or hanging async tasks.
- The Closure properties are incorrect in a number of cases.

<!-- Please describe the current behavior that you are modifying and link to one or more relevant issues. -->
Issue Number: 
Relates to angular#11485. Relates to angular#11486. Fixes angular#11487.

## What is the new behavior?

- set ng-href on nav-item even if md-nav-href is empty
- fix closure properties to better represent the existing code
- pin the version of jasmine-core since we don't support 2.99.1 yet
- slightly improve the tone of the exceptions
- pull in some karma configuration tweaks from Angular Material

## Does this PR introduce a breaking change?
```
[ ] Yes
[x] No
```
<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->
<!-- Note that breaking changes are highly unlikely to get merged to master unless the validation is clear and the use case is critical. -->

## Other information
marosoft pushed a commit to marosoft/material that referenced this pull request Nov 11, 2018
… reader users

* make the nav-bar component a tablist.
* make the nav-item's li element presentational and the button a tab.
* apply the aria-label, if provided, to the button directly, not the li element.

Fixes angular#11485

<!-- 
Filling out this template is required! Do not delete it when submitting a Pull Request! Without this information, your Pull Request may be auto-closed.
-->
## PR Checklist
Please check that your PR fulfills the following requirements:
- [x] The commit message follows [our guidelines](https://github.com/angular/material/blob/master/.github/CONTRIBUTING.md#-commit-message-format)
- [x] Tests for the changes have been added or this is not a bug fix / enhancement
- [x] Docs have been added, updated, or were not required

## PR Type
What kind of change does this PR introduce?
<!-- Please check the one that applies to this PR using "x". -->
```
[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?

<!-- Please describe the current behavior that you are modifying and link to one or more relevant issues. -->
Issue Number: angular#11485 

Currently, the nav-bar element is exposed as a listbox accessible to screen reader users. Its nav-item child consists of a li element which currently has role "option" (as appropriate for a listbox child), and the button inside that li is exposed as is.

Screen readers do have a hard time interacting with this construct, since they do not expect an option to contain a button.

## What is the new behavior?

The new behavior is that the nav-bar element is exposed as a tablist, and the button inside the li of the nav-item as a tab accessible. In addition, the aria-label that was originally applied to the nav-item's li element is now applied to the buton, since the li in the tablist/tab pattern is to be marked presentational. aria-label must therefore go onto the element that has role "tab".

No changes besides semantic ARIA exposure has been changed, the keyboard behavior is the same as well as any other behavior this component exposes. Web developers needn't change anything, either.

## Does this PR introduce a breaking change?
```
[ ] Yes
[x] No
```
<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->
<!-- Note that breaking changes are highly unlikely to get merged to master unless the validation is clear and the use case is critical. -->

## Other information

The tests have been adjusted to look for the aria-label on the tab directly, not the parent.
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/ P1: urgent Urgent issues that should be addressed in the next minor or patch release. 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.

nav-bar: Screen readers can't properly interact with a button inside an option inside a listbox.
4 participants