Skip to content

bug(mat-timepicker): 1 min interval click handler slow warning #30539

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task
JoelOvatic opened this issue Feb 24, 2025 · 5 comments
Closed
1 task

bug(mat-timepicker): 1 min interval click handler slow warning #30539

JoelOvatic opened this issue Feb 24, 2025 · 5 comments
Labels
needs triage This issue needs to be triaged by the team

Comments

@JoelOvatic
Copy link

JoelOvatic commented Feb 24, 2025

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

When I create a timepicker with an interval of 1 min a violation warning occurs

<div>
  <mat-form-field>
    <mat-label>Every 1 min</mat-label>
    <input matInput [matTimepicker]="hoursPicker" />
    <mat-timepicker-toggle matIconSuffix [for]="hoursPicker" />
    <mat-timepicker interval="1min" #hoursPicker />
  </mat-form-field>
</div>

warning:
[Violation] 'click' handler took 445ms

Reproduction

StackBlitz link: https://stackblitz.com/edit/zznk2yuz?file=src%2Fexample%2Ftimepicker-overview-example.html
Steps to reproduce:

  1. open console
  2. open timepicker dropdown
  3. wait ~500ms

Expected Behavior

opens instantly

Actual Behavior

opens in ~500ms

Environment

  • Angular: 19.0.5
  • CDK/Material: 19.0.3
  • Browser(s): firefox/chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): windows
@JoelOvatic JoelOvatic added the needs triage This issue needs to be triaged by the team label Feb 24, 2025
@crisbeto
Copy link
Member

It's because it needs to generate 1440 options which can take a while. I'd recommend setting a min and max so users don't have to scroll many options. Closing since it's working as expected.

@JorisvanderSluisOvatic
Copy link

I disagree with this resolution. Limiting the selection range would restrict applications that require a full 24-hour time span.

Instead, I would expect a more efficient solution, such as implementing virtual scrolling within the time picker’s selection list to avoid rendering all 1440 options at once.

@crisbeto
Copy link
Member

I've updated #10122 to track adding virtual scrolling.

@JorisvanderSluisOvatic
Copy link

A possible alternative solution would be implementing two selection lists:

One for selecting the hour (0-23).
One for selecting the minutes (0-59).
This approach mimics the built-in HTML element, which provides a similar selection mechanism.

For reference, see the official documentation:
MDN

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs triage This issue needs to be triaged by the team
Projects
None yet
Development

No branches or pull requests

3 participants