bug(table) stickyness of header-cell is ignored in sticky header-row when on Edge using flex-style table
See original GitHub issueBug, feature request, or proposal:
Bug
What is the expected behavior?
Sticky columns in a sticky row should behave as both stickyness rules applies
What is the current behavior?
Once the header is set as sticky, the header-cells behave as they don’t have position: sticky
.
Happens only with flex-style table, runs fine with native table (except all the others horrible GUI problems with it).
Happens only on Edge, runs fine on Chrome and Firefox.
What are the steps to reproduce?
https://stackblitz.com/edit/angular-1jas2g
What is the use-case or motivation for changing an existing behavior?
It’s broken
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular 6.1.1 Angular Material 6.4.7 Edge: 17.17134 Windows 10 Typescript 2.9.x
Is there anything else we should know?
Hi ❤️
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:13 (11 by maintainers)
Top Results From Across the Web
Angular material table sticky headers not working as expected
The problem in your example is that the table container has overflow: auto and height: 100% ; this is unnecessary, since the page...
Read more >Position Sticky and Table Headers | CSS-Tricks
It makes way more sense to sticky a parent element like the table header rather than each individual element in a row. The...
Read more >Sticky Table Header with React Hooks - Miroslav Nikolov
Painless component-wise split between header and content (table rows); Works out of the box (no CSS). All these play a role in the...
Read more >Sticky Table Headers & Columns - Codrops
A tutorial on how to create sticky headers and columns for tables using jQuery. The solution is an alternative to other sticky table...
Read more >So hard to make table header sticky - DEV Community
It is classic to display data with a table, each row is a record, each column is a data field, and th... Tagged...
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
My explorations continues. We need these informations in one place to make the fix consistent:
Edge can be detected from pretty much everywhere using feature detection so that’s not a problem.
I studied a bit the CDK table code and I’m not sure which would be the best place to put the fix, but I have a couple of ideas:
stickRows
in sticky-styler: it has access to all rows native elements and knows which ones must be sticky (1
,2
). It has an internal property to keep track if the type of table (4
). Only problem, it cannot check in an easy and fast way if a row have inside at least one sticky column (not3
);updateStickyColumns
in sticky-styler: it has access to all rows native elements (2
), it can access the table type (4
) and has information about which columns are sticky (3
). We don’t have here information about the stickyness of the rows (not1
);We probably should keep the fix code inside sticky-styler, but we never have all the info we need. The last method which knows all the info we need is
_addStickyColumnStyles
in table.ts. The problem here is that it defines therowDef
parameter as of typeBaseRowDef
, because it takes as assumption that stickyness isn’t needed anymore, instead of keepingCdkHeaderRowDef
andCdkFooterRowDef
definitions which extends the base class keeping into account the stickiness.A possible solution would be to add a
isSticky
parameter at the end of theupdateStickyColumns
method call which defaults to false, then change_addStickyColumnStyles
second parameter type to an union type with all row types (CdkHeaderRowDef | CdkFooterRowDef | CdkRowDef
) and pass in the sticky property (with a not-null assertion).In this way, when the sticky property is not present we’ll get an undefined which will default to false while, when it’s present, the actual value will be passed on allowing us to get the stickyness of a row inside
updateStickyColumns
.This is possible because header and footer rows are passed one by one to the
_addStickyColumnStyles
method, if this changes the fix will break and a comment (and an automatic test) must be put in place to prevent random code failule.All this changes will be documented with instruction to rollback when nested sticky elements problem is solved by Edge team.
Tomorrow I’ll try to define the code to actually put in place the fix inside sticky-styler class.
@andrewseguin what do you think about this? It’s not perfect but it may just work as a temporary patch
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.