Disabled date entered manually is not reverted on blur
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 68/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- react, typescript
- Domaine
- frontend
Piste de recherche
Start by tracing the blur path through flushFieldSubmit, triggerSubmitChange, and the popup-close handling described in the issue; compare it with the Enter path and the previous useRangeValue reset behavior. Add or update a regression test for a controlled picker with a rejected disabledDate, then verify blur restores the selected value while Enter continues to do so.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Description
Since @rc-component/picker 1.12.0, manually entering a date rejected by disabledDate and then blurring the input leaves the rejected date displayed.
In 1.11.0, the input reverted to the previously selected value after blur.
Enter and blur now behave differently: pressing Enter restores the previous value, while blurring leaves the disabled date in the input.
Reproduction
Use a controlled single date picker with:
- Moment generateConfig
- Format: MM/DD/YYYY
- Value: 06/15/2026
- disabledDate rejecting dates before 06/01/2026
- State updated only through onChange
- Focus the input.
- Replace its contents with 03/15/2026.
- Click outside the picker.
Expected behavior
The disabled date is rejected, and the input displays the previously selected value, 06/15/2026, consistent with version 1.11.0.
Actual behavior
The input continues to display 03/15/2026, although onChange does not accept that date and the controlled value remains 06/15/2026.
Repeating the same steps but pressing Enter instead of clicking outside restores 06/15/2026.
Minimal example
import React, { useState } from 'react';
import Picker from '@rc-component/picker';
import momentConfig from '@rc-component/picker/lib/generate/moment';
import enUS from '@rc-component/picker/lib/locale/en_US';
import moment from 'moment';
const format = 'MM/DD/YYYY';
const minDate = moment('06/01/2026', format);
export default function Example() {
const [value, setValue] = useState(moment('06/15/2026', format));
return (
<Picker
generateConfig={momentConfig}
locale={enUS}
format={format}
value={value}
disabledDate={(date) => date.isBefore(minDate, 'day')}
onChange={setValue}
/>
);
}
Versions verified
- 1.11.0: previous value is restored on blur.
- 1.12.0: disabled date remains displayed on blur.
- 1.15.0: same behavior as 1.12.0.
Possible cause
This appears related to PR #994, which introduced useRangeValueChange.
Previously, useRangeValue reset the temporary calendar value to mergedValue after the interaction ended.
In the new flow, flushFieldSubmit calls triggerSubmitChange and closes the popup without handling its false return value. When disabledDate rejects the submission, the temporary calendar value is not reset on blur.
After Enter, the interaction is already completed when popupClose is processed, which takes the reset path and restores the previous value.
- Langage dominant
- TypeScript
- Étoiles
- 307
- Forks
- 349
- Merge moyen
- 43 min
- PR mergées (30 j)
- 1
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de react-component/picker
-
enter date manually in format YY prevent the user to add YYYYPeut-être pris @nrps9909 l’a pris il y a 66 jours. Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 48/100
react-component/picker#956 · 1 commentaire · 1 réaction ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 30/100
react-component/picker#955 · 1 commentaire · 1 réaction ·
-
[Bug / DX]: Deep imports for generateConfig are incompatible with pnpm and break module resolutionPeut-être pris @DanielChutkowskiJMMJ l’a pris il y a 348 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 58/100
react-component/picker#949 ·
-
DatePicker does not trigger onChange when manually clearing input textPeut-être pris @nrps9909 l’a pris il y a 66 jours. Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 55/100
react-component/picker#946 ·
-
需要RangePicker组件中增加aria属性Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 45/100
react-component/picker#939 ·
Toutes les issues de react-component/picker
Issues similaires
-
Add: Class TV ModaOuvertecheck:passed streams:add
Difficulté 1/5 Moins d'une heure Accessibilité débutants 65/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
GiganticMinecraft/seichi-playguide#183 ·
Les mainteneurs répondent en général sous 1 jour
-
area: core complexity: easy impact: medium
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
ueberdosis/tiptap#8668 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
longbridge/nsh#804 ·
Les mainteneurs répondent en général sous 1 jour