Disabled date entered manually is not reverted on blur
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 68/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- react, typescript
- Lĩnh vực
- frontend
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 304
- Fork
- 347
- Merge trung bình
- 1 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của react-component/picker
-
enter date manually in format YY prevent the user to add YYYYCó thể đã có người làm @nrps9909 đã nhận 43 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
react-component/picker#956 · 1 bình luận · 1 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
react-component/picker#955 · 1 bình luận · 1 reaction ·
-
[Bug / DX]: Deep imports for generateConfig are incompatible with pnpm and break module resolutionCó thể đã có người làm @DanielChutkowskiJMMJ đã nhận 325 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 58/100
react-component/picker#949 ·
-
DatePicker does not trigger onChange when manually clearing input textCó thể đã có người làm @nrps9909 đã nhận 43 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
react-component/picker#946 ·
-
需要RangePicker组件中增加aria属性Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
react-component/picker#939 ·
Tất cả issue của react-component/picker
Issue tương tự
-
[Bug]: Server git tests sign fixture commits with the developer's key when run from the repo rootĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
melgarafael/DeskcommCRM#2657 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
MystenLabs/MemWal#1163 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Mondriaan
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
knaw-huc/textannoviz#709 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
billion-context-pi
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
ranxianglei/billion-context#2521 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày