feat(chips): support specifying the field to use as an identifier w/ a11y messages when using chips that are Objects #11536
Description
Bug, enhancement request, or proposal:
Proposal
CodePen and steps to reproduce the issue:
CodePen Demo which demonstrates the issue:
https://material.angularjs.org/HEAD/demo/chips
Detailed Reproduction Steps:
- In the basic usage demo, interact with the last set of chips (custom template) while using a screen reader
- Also interact with the contact chips demo using a screen reader
What is the expected behavior?
We need to define an API which specifies the field in the chip Object
s to use as the label and announcement text. In the case below, this would be something like md-chip-label-field="name"
. Please provide feedback or suggestions on this API if you have thoughts to share.
What is the current behavior?
Due to exceptions trying to parse objects with recursive references, we had to disable announcing or labeling object chips in #11535.
This means that for chips with Object
arrays as models (instead of string
arrays), we just announce removed
or added
when chips are removed or added instead of something like {"name":"Broccoli","type":"Brassica"} removed
(which is read as name Broccoli type Brassica removed
).
Also for aria-labels
on existing chips, we only use Press delete to remove this chip.
instead of {"name":"Broccoli","type":"Brassica"}. Press delete to remove this chip.
when chips are based on Objects.
What is the use-case or motivation for changing an existing behavior?
a11y
Which versions of AngularJS, Material, OS, and browsers are affected?
- AngularJS: 1.1.11
- AngularJS Material: 1.7.5
- OS: macOS
- Browsers: Chrome