[Sort] Cannot add clickable icon inside of the sort header in IE
See original GitHub issueBug, feature request, or proposal:
Adding a clickable icon is to a mat-sort-header
is not possible in IE11. IE11 will not listen to click events inside of <button>
. Changing to <div>
might work.
What is the expected behavior?
Adding click events to header should work in IE11.
What is the current behavior?
Click events are completely ignored by IE11 browser.
What is the use-case or motivation for changing an existing behavior?
Adding additional clickable icons in the Table header.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular 4.4.4 Material 2.0.0.beta.12 Typescript 2.4.2 IE11 Wandows
Is there anything else we should know?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Mat-table Sorting Demo not Working - Stack Overflow
this is fine, in the header text is clickable and the icon is also there but still sorting is not working. Can I...
Read more >Sort header - Angular Material
To add sorting behavior and styling to a set of table headers, add the <mat-sort-header> component to each header and provide an id...
Read more >Add interactive sort to a table or matrix in paginated reports
In a table or matrix in report design view, right-click the text box in the column header for the group to which you...
Read more >jQuery plugin: Tablesorter 2.0 - Angel Pet Sitters
Property Type Default Link
cancelSelection Boolean true
cssAsc String ""
cssChildRow String "tablesorter‑childRow" 1 2
Read more >D12337 Give the file dialogs a "Sort by" menu button on the toolbar
FWIW, here's the macOS sort icon, as shown in the open dialog: ... the text right in the toolbar, move it as a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As a workaround, you can move the
mat-sort-header
directive to an element inside of themat-header-cell
:So if you have something like:
Moving the directive into the span will work (with some minor styling tweaks):
Also happening in Firefox 😦
Default
<ng-content>
inside button is limiting the user’s possibilities:https://github.com/angular/material2/blob/63f713f846a1b2c5a69c4342f0816085a341457f/src/lib/sort/sort-header.html#L4-L10
Current spec for buttons in HTML5’s living standard says:
There could be a prop like
interactuableContent
in the mat-sort, that would make the content render inside a div instead of a button (being backwards compatible).Thanks, guys.
EDIT: @ozsivanov has suggested a better approach that could work as a workaround later in this thread 👇