angular / angular/components

feat(COMPONENT): Add Possibility to stop Page Change on Paginator

Open
#30,302 0 comments 1 reaction 0 assignees View on GitHub
area: material/paginator feature P4
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

### Feature Description

Currently when you press any button on the paginator the page is changed and the PageEvent is emitted afterwards.

It would be great to be able to intercept the pageEvent before it is done and maybe call something like `event.stopPropagation()` and or `event.preventDefault()`

### Use Case

There is no way of stopping the page change for example if you would want to implement a dialog which confirms if the user wants to lose their changes made on the current page. (Especially when the paginator is not connected to the table and the pagination is used for the backend)
Here is a [stackblitz](https://stackblitz.com/edit/pbfhnu68-qn7l5mng?file=src%2Fexample%2Ftable-pagination-example.html) that shows the problem.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the paginator behavior in the linked StackBlitz and trace when the PageEvent is emitted relative to the page change. Determine how an early interception should signal cancellation, then verify that a confirmed navigation still changes the page and emits the event as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Feature
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.