angular / angular/components

bug(mat-table): Re-orderable sticky columns become un-sticky if you start dragging, abort the drag, and then scroll

Open
#26,384 4 comments 0 reactions 0 assignees View on GitHub
area: material/table P4
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

### Is this a regression?

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

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

_No response_

### Description

If you create a Material Design Table with **reorderable columns** that are also **sticky**, the column headers become un-sticky if you start to reorder a column, abort, and then scroll.

StackBlitz that reproduces the issue: https://stackblitz.com/edit/angular-kyaurw?file=src/app/table-sticky-header-example.html

### Reproduction

Steps to reproduce:
1. https://stackblitz.com/edit/angular-kyaurw?file=src/app/table-sticky-header-example.html
2. Click and hold a column header and start to drag it, but release the mouse button before dropping it in a new location
3. Scroll down
4. The column header is no longer sticky (see screenshot of the issue)
![unsticky_example](https://user-images.githubusercontent.com/1097608/211224588-af3abd24-95bd-4bbd-96c6-75d94e4bd297.png)

### Expected Behavior

If you abort a drag/drop, the column header should still be sticky like all of the other headers.

### Actual Behavior

If you abort a drag/drop, the column header you clicked is no longer sticky.

### Environment

- Angular: 15.0.4
- CDK/Material: 15.0.4
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows

Contributor guide

Open the contributing guide

Research direction

Start with the linked StackBlitz reproduction and its src/app/table-sticky-header-example.html entry point. Reproduce the aborted drag followed by scrolling in Chrome, then trace the table's sticky-column and reordering behavior. Done means the aborted drag no longer causes the selected header to become un-sticky.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.