-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(material/dialog): dialog name on mac only using aria-label #29264
base: main
Are you sure you want to change the base?
Conversation
Deployed dev-app for c17c4f0 to: https://ng-dev-previews-comp--pr-angular-components-29264-dev-rjpcttjr.web.app Note: As new commits are pushed to this pull request, this link is updated after the preview is rebuilt. |
4d12a2a
to
9a62391
Compare
478e548
to
2342929
Compare
bac212f
to
c8c15d7
Compare
b830917
to
85be3e2
Compare
@@ -68,7 +68,7 @@ export function throwDialogContentAlreadyAttachedError() { | |||
'[attr.aria-modal]': '_config.ariaModal', | |||
'[attr.aria-labelledby]': '_config.ariaLabel ? null : _ariaLabelledByQueue[0]', | |||
'[attr.aria-label]': '_config.ariaLabel', | |||
'[attr.aria-describedby]': '_config.ariaDescribedBy || null', | |||
'[attr.aria-describedby]': '_config.ariaLabel ? null : _ariaDescribedByQueue[0]', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there are multiple, shouldn't they all be part of the aria-describedby, not just the first one?
@@ -117,6 +126,59 @@ export class MatDialogContainer extends CdkDialogContainer<MatDialogConfig> impl | |||
); | |||
} | |||
|
|||
/** Get userAgent to check for useragent operating system */ | |||
private _getUserPlatform = (): string => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a cdk/platform package that we use for this type of thing
@@ -93,6 +97,11 @@ export class MatDialogContainer extends CdkDialogContainer<MatDialogConfig> impl | |||
: 0; | |||
/** Current timer for dialog animations. */ | |||
private _animationTimer: ReturnType<typeof setTimeout> | null = null; | |||
/** Platform Observer */ | |||
// private _userAgentSubscription = Subscription.EMPTY; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove commented out code
}; | ||
|
||
/** Get Dialog name from aria attributes */ | ||
private _getDialogName = (): string => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method seems pretty crazy and I would hope we can find a better way to accomplish this.
Also just in general, its bad practice to have a method called getXYZ
that you rely on for its side effects rather than its return value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the input, Miles! Revising now.
85be3e2
to
8cbf870
Compare
Fixes bug with Angular Components Dialog component on Mac whether using Chrome or Firefox the screenreader does not read the dialog name/title unless it is using an aria-label. Updates the dialog-content-directives to read/apply the aria- labelledby and aria-describedby values if they exist. Fixes b/274674581
Fixes issue with Angular Components Dialog component where VoiceOver does not read the dialog name if the dialog is supposed to be read by aria-labelledby or aria-describedby attributes. Updates dialog-container.ts so that the aria-labelledby or aria-described by value (if any) is used as an aria-label value. Fixes b/274674581
Fixes Angular Components Dialog component where the dialog name is not read by VoiceOver/screenreader on macOS chrome & firefox browsers. Attempts to retrieve any id associated with aria-labelledby or aria-describedby and taking the innerHTML or the aria-label of that element and applying that value to the dialog's aria-label. Fixes b/274674581
…ome or firefox Fixes bug in Angular Components Dialog component where the aria-labelledby and aria-describedby values are not being read by Chrome or Firefox when using a mac. This checks if there is an html attribute of aria-labelledby or aria-describedby and grabs the innerText or aria-label value and uses that value as the aria-label for the dialog only on mac using chrome or firefox. Fixes b/274674581
…ome and firefox Fixes Angular Components Dialog component where the mac screenreader is not reading the associated aria-labelledby id value as the dialog name/title. Fixes logic checking for macos so that the function_getDialogName() gets called when the value of the arialabelledby id element gets inserted into the aria-label value. Fixes b/274674581
Cleans up fix for Angular Component Dialog component's fix to update the dialog aria-label if the user's OS is a mac since mac using a chrome or firefox browser the screenreader does NOT read the dialog name if the value is portrayed by aria-labelledby or aria-describedby. Cleaned up console logs and unused attributes. Fixes b/274674581
…ome or firefox Cleans up unused variables and comments. Fixes b/274674581
…firefox Removes test console logs from CDK dialog-container.ts. Fixes b/274674581
…sing chrome or firefox Updates fix for Angular Components Dialog issue where the dialog name is not being read by the screenreader when specifically using macos (and potentially ios) screenreader when using chrome or firefox browsers. Removes unused commented out code and includes ios as part of the logic to call _getDialogName(). Fixes b/274674581
bd8b33f
to
c17c4f0
Compare
Fixes bug with Angular Components Dialog component on Mac whether using Chrome or Firefox the screenreader does not read the dialog name/title unless it is using an aria-label. Updates the dialog-content-directives to read/apply the aria- labelledby and aria-describedby values if they exist.
Fixes b/274674581