Skip to content

mat-dialog-close wrongly adds an aria-label when the button text content is bound rather than static #15542

Closed

Description

@stevenyxu

What is the expected behavior?

When I have <button mat-dialog-close>Submit</button> in a template, I expect for the resulting HTML to be basically the same, and mat-dialog-close should not add an aria label to the button.

What is the current behavior?

<button mat-dialog-close aria-label="Close dialog">Submit</button>

What are the steps to reproduce?

https://stackblitz.com/edit/angular-j9paiz?file=app/dialog-overview-example-dialog.html

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Head.

Is there anything else we should know?

This area was partly addressed in #11093 but has this remaining bug. A workaround is available (just set aria-label explicitly in addition to the inner content), but this is not ideal.

stevenyxu@6645309 demonstrates the bug in the form of a failing unit test. I tried to do a fix but couldn't quickly come up with a performant solution without more work.

Activity

  1. added
    P2
    Accessibility
    G
    on Mar 23, 2019
  2. jelbourn commented on Mar 23, 2019

    @jelbourn
    Contributor

    @crisbeto we should probably just use a mutation observer here

  3. added 4 commits that reference this issue on Mar 23, 2019
    6337dd4
    90df4c6
    de963dd
    4e84016
  4. added a commit that references this issue on Apr 3, 2019
    c3ead65
  5. added a commit that references this issue on Apr 4, 2019
    307889e
  6. angular-automatic-lock-bot commented on Sep 10, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  7. locked and limited conversation to collaborators on Sep 10, 2019
  8. added a commit that references this issue on Nov 5, 2026
    ed90809
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

AccessibilityGP2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions