angular / angular/components

bug(table): Table with sticky header 'jumping'

Open
#27,313 3 comments 0 reactions 0 assignees View on GitHub
area: material/progress-bar P4
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

### Is this a regression?

- [X] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

_No response_

### Description

When scrolling, a table with a sticky header "jumps" if you add an element that has a absolute position. For example, if you display the tooltip and scroll, then the sticky header will change position for a short time.
This is also true with the mat-progress-bar element.

### Reproduction

StackBlitz link:
Steps to reproduce:
1. Open [link](https://stackblitz.com/edit/gatzhq-oe6hfq?file=src%2Fexample%2Ftable-sticky-header-example.ts)
2. The sticky header changes the position on scroll when there is another element on the page with absolute position

https://github.com/angular/components/assets/16895663/bf5172c5-8cba-4a0b-b5da-89afab55d7ee

### Expected Behavior

The sticky header should not change position on scroll when there is another element on the page with an absolute position

### Actual Behavior

The sticky header changes the position on scroll when there is another element on the page with absolute position

### Environment

- Angular: v12, v15, v16
- CDK/Material: v12, v15, v16
- Browser(s): **Chrome Version 114.0.5735.110 (Official Build) (64-bit)**
- Operating System (e.g. Windows, macOS, Ubuntu): **Windows**

Contributor guide

Open the contributing guide

Research direction

Start with the linked StackBlitz reproduction and confirm the sticky-header jump while scrolling with the tooltip or mat-progress-bar present. Then trace the table sticky-header implementation and related tests in the Angular components repository. Done means the header remains stable during scrolling when another absolutely positioned element is present.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.