fix(material/sort): add description input for sort-header#23633
fix(material/sort): add description input for sort-header#23633zarend merged 1 commit intoangular:masterfrom
Conversation
|
|
||
| this._sort.register(this); | ||
|
|
||
| this._sortButton = this._elementRef.nativeElement.querySelector('[role="button"]')!; |
There was a problem hiding this comment.
Should we use a ViewChild query to get the button instead of querying directly?
There was a problem hiding this comment.
IMO I don't see the point of using @ViewChild to query for native DOM elements (vs. directives or injectables)
|
|
||
| // If _sortButton is undefined, the component hasn't been initialized yet so there's | ||
| // nothing to update in the DOM. | ||
| if (this._sortButton) { |
There was a problem hiding this comment.
Do we also need to check that the description is defined/isn't an empty string here?
There was a problem hiding this comment.
AriaDescriber already checks the presence of the message internally
f2e49a2 to
3bb13ed
Compare
crisbeto
left a comment
There was a problem hiding this comment.
LGTM, but the CI is failing.
src/components-examples/material/table/table-sorting/table-sorting-example.ts
Show resolved
Hide resolved
Adds a description input for mat-sort-header so that developers can provide an accessible description (using AriaDescirber under the hood). Additionally update the accessibility section for the sort header's documentation with guidance on providing an accessible experience. I decided to use this approach instead of expanding `MatSortHeaderIntl` because the message developers would want to set here depends on several bits of information, including: * Whether the column is currently sorted * The sort direction * Whether users can clear sorting (configured on `MatSort`) * The name of the column (not the ID) Accounting for all of these factors would have made the intl formatting too complicated. This does have the negative consequence of needing to set a description for every header. However, users can add a custom directive to set the description in a consistent way if they have an application with many tables.
Adds a description input for mat-sort-header so that developers can provide an accessible description (using AriaDescirber under the hood). Additionally update the accessibility section for the sort header's documentation with guidance on providing an accessible experience. I decided to use this approach instead of expanding `MatSortHeaderIntl` because the message developers would want to set here depends on several bits of information, including: * Whether the column is currently sorted * The sort direction * Whether users can clear sorting (configured on `MatSort`) * The name of the column (not the ID) Accounting for all of these factors would have made the intl formatting too complicated. This does have the negative consequence of needing to set a description for every header. However, users can add a custom directive to set the description in a consistent way if they have an application with many tables. (cherry picked from commit ecd54f4)
Adds a description input for mat-sort-header so that developers can provide an accessible description (using AriaDescirber under the hood). Additionally update the accessibility section for the sort header's documentation with guidance on providing an accessible experience. I decided to use this approach instead of expanding `MatSortHeaderIntl` because the message developers would want to set here depends on several bits of information, including: * Whether the column is currently sorted * The sort direction * Whether users can clear sorting (configured on `MatSort`) * The name of the column (not the ID) Accounting for all of these factors would have made the intl formatting too complicated. This does have the negative consequence of needing to set a description for every header. However, users can add a custom directive to set the description in a consistent way if they have an application with many tables. (cherry picked from commit ecd54f4)
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Adds a description input for mat-sort-header so that developers can provide an accessible description (using AriaDescirber under the hood). Additionally update the accessibility section for the sort header's documentation with guidance on providing an accessible experience.
I decided to use this approach instead of expanding
MatSortHeaderIntlbecause the message developers would want to set here depends on several bits of information, including:MatSort)Accounting for all of these factors would have made the intl formatting too complicated.
This does have the negative consequence of needing to set a description for every header. However, users can add a custom directive to set the description in a consistent way if they have an application with many tables.
cc @zarend @amysorto