feat: remove labels from date/time fields and auto-close TimePicker dropdown

- Remove label prop from all DatePicker and TimePicker components
- Add aria-label to inputProps for accessibility and testing
- Auto-close TimePicker dropdown when selecting an option
- Add 0.1s delay before calling time change handlers after closing dropdown
- Add test case to verify aria-label attributes
This commit is contained in:
Lê Nhân Phụng
2025-12-05 16:25:50 +07:00
committed by Benoit TELLIER
parent e4d3722992
commit 8b88faffe2
3 changed files with 114 additions and 35 deletions
@@ -241,4 +241,24 @@ describe("DateTimeFields", () => {
)
);
});
it("should have aria-label for accessibility and testing", async () => {
await renderField({
startDate: "2025-01-01",
startTime: "10:00",
endDate: "2025-01-01",
endTime: "11:00",
showMore: true,
});
const startDateInput = screen.getByTestId("start-date-input");
const startTimeInput = screen.getByTestId("start-time-input");
const endDateInput = screen.getByTestId("end-date-input");
const endTimeInput = screen.getByTestId("end-time-input");
expect(startDateInput).toHaveAttribute("aria-label", "dateTimeFields.startDate");
expect(startTimeInput).toHaveAttribute("aria-label", "dateTimeFields.startTime");
expect(endDateInput).toHaveAttribute("aria-label", "dateTimeFields.endDate");
expect(endTimeInput).toHaveAttribute("aria-label", "dateTimeFields.endTime");
});
});