Skip to content

Double selected month and year when previously selected and selected via keyboard" #5576

Closed as duplicate of#5575
@Nataly19910601

Description

@Nataly19910601

Bug description:
When the YearPicker and MonthPicker are enabled in the react-datepicker component, and a date is already selected, clicking on a month or a year adds the classes react__month-text--keyboard-selected and react-datepicker__year-text--keyboard-selected. However, the classes react-datepicker__year-text--selected and react-datepicker__month-text--selected (or __year-text--range-start, __month-text--range-start in the case of a range) are not removed from the previously selected dates.

Steps to reproduce:

Enable YearPicker and MonthPicker in the react-datepicker component.

Select a date.

Click on a month or a year.

Notice that the old classes react-datepicker__year-text--selected and react-datepicker__month-text--selected do not disappear, and the new classes react__month-text--keyboard-selected and react-datepicker__year-text--keyboard-selected are added.

Expected behavior:
After clicking on a month or a year, the old classes should be removed, and the new classes should be added correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions