Skip to content

Bug - [DatePicker] - [JavaScript error thrown when an invalid date is given] #9721

@jelly

Description

@jelly

Describe the problem

In Cockpit we have a test where we enter an invalid date into the date picker which leads to no date being selected when opening the datePicker:

image

When I add a breakpoint to the line above of where the exception happens, I noticed the focusTrap basically tries to execute

document.querySelector('.pf-v5-c-calendar-month__dates-cell.pf-m-selected'); 

Which returns null.

I've found out that reverting this commit no longer throws a JavaScript error.

How do you reproduce the problem?

I've had issues with reproducing the problem in a codesandbox, our Datepicker usage is a bit non-trivial.

Expected behavior

A component should never throw an JavaScript exception.

Is this issue blocking you?

Currently we have no workaround, except disabling the test for now.

What is your environment?

  • OS: Linux
  • Browser chrome
  • Version

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions