mui / mui/mui-x

[pickers] onAccept not called when re-selecting same value

Open
#19,829 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

scope: pickers type: bug
Dominant language
TypeScript
Stars
5.8k
Forks
1.8k
Avg merge
2d 10h
Merged PRs (30d)
148

Description

Steps to reproduce

Steps:

  1. Open this link to live example
  2. Select date via picker
  3. Click to "Set time" button
  4. Re-select the same date as in step (2) via the picker
Current behavior
  • In step (2) onAccept callback called (see "--onAccept TimePicker" print in console)
  • In step (4) onAccept callback not called
Expected behavior
  • The onAccept callback should be called in both step (2) and step (4), even when the selected date is the same
  • For a controlled input, the same behavior should occur whether the value changes via the onChange callback or through anothe way
Context
  • Related issue #18491
  • It seems that lastCommittedValue should be updated whenever the prop value changes
Your environment
npx @mui/envinfo
  System:
    OS: Linux 5.15 Ubuntu 24.04.1 LTS 24.04.1 LTS (Noble Numbat)
  Binaries:
    Node: 20.19.4 - /home/alu/.nvm/versions/node/v20.19.4/bin/node
    npm: 10.8.2 - /home/alu/.nvm/versions/node/v20.19.4/bin/npm
    pnpm: 10.13.0 - /home/alu/.local/share/pnpm/pnpm
  Browsers:
    Chrome: 141.0.7390.55
  npmPackages:
    @emotion/react: 11.14.0 => 11.14.0 
    @emotion/styled: 11.14.1 => 11.14.1 
    @mui/core-downloads-tracker:  7.3.4 
    @mui/icons-material: 7.3.4 => 7.3.4 
    @mui/material: 7.3.4 => 7.3.4 
    @mui/private-theming:  7.3.3 
    @mui/styled-engine:  7.3.3 
    @mui/system:  7.3.3 
    @mui/types:  7.4.7 
    @mui/utils:  7.3.3 
    @mui/x-date-pickers: 8.12.0 => 8.12.0 
    @mui/x-internals:  8.12.0 
    @types/react: 19.2.0 => 19.2.0 
    react: 19.2.0 => 19.2.0 
    react-dom: 19.2.0 => 19.2.0 
    styled-components:  6.1.19 
    typescript: 5.9.3 => 5.9.3

Search keywords: onAccept

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked CodeSandbox and trace the picker flow around the onAccept callback and lastCommittedValue. No repository files or tests are named; done means onAccept fires when re-selecting the same date, including for controlled inputs, and existing picker behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.