Skip to content

Support custom sort-headers that don't make the entire header a button #14456

Open
@vibos

Description

@vibos

What is the expected behavior?

I want to create some UI elements inside sort-header cell and want them to be available. Now it works fine in Chrome and Edge.

What is the current behavior?

The problem is that all content inside heading cell with sorting is wrapped into button
src/lib/sort/sort-header.html

  <button class="mat-sort-header-button" type="button"
          [attr.disabled]="_isDisabled() || null"
          [attr.aria-label]="_intl.sortButtonLabel(id)"
          (focus)="_setIndicatorHintVisible(true)"
          (blur)="_setIndicatorHintVisible(false)">
    <ng-content></ng-content>
  </button>

But in Firefox clicking any children elements won't work because it is nested inside a button. See issue on StackOverflow.

What are the steps to reproduce?

Open StackBlitz and try clicking red button.
Chrome, Edge - you'll have alert message.
Mozilla Firefox - no messages.

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

Any Mozilla Firefox.

Is there anything else we should know?

My suggestion is to use <a href="#"> instead of button. Then behaviour would be the same in every browser. Using of a tag is not such nice as div, but it allows to keep tab-navigation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4A relatively minor issue that is not relevant to core functionsarea: material/sortfeatureThis issue represents a new feature or feature request rather than a bug or bug fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions