Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #5200: Fix the unnecessary highlight on the Week Number when the first day of the week is selected using Keyboard #37

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

balajis-qb
Copy link
Collaborator

@balajis-qb balajis-qb commented Nov 17, 2024

Closes Hacker0x01#5200

Description

As mentioned in the ticket, when showWeekNumbers is enabled in a datepicker, the keyboard select on the first day of the week alone highlights the week number. When we select any other week days it's not highlighting. This issue is not occuring in the mouse hover of any week days.

Why the issue occurs?

image

As I shared in the above screenshot, we passed the start of the week to each corresponding week number and in the <WeekNumber /> component we apply a class react-datepicker__week-number--keyboard-selected when the date prop (which is start of the week) is selected.

Changes

  • As a fix, I removed the setting of react-datepicker__week-number--keyboard-selected to . The reason is because we are not applying any class to it when we hover the first day of the week using mouse. Also if we plan to highlight the week number it should enabled for all week days and not just the start date and it should be applied to the mouse hover aswell. But I don't think that's necessary as the week number we're displaying is just looks like a read-only kind of view, as it's grayed out currently. Hence I feel removing the class react-datepicker__week-number--keyboard-selected would be a better way to fix the issue.
  • I also updated the existing test cases

Contribution checklist

  • I have followed the contributing guidelines.
  • I have added sufficient test coverage for my changes.
  • I have formatted my code with Prettier and checked for linting issues with ESLint for code readability.

… for the <WeekNumber /> component

- Removed as highlighting the first day of the week alone highlights the week number - Because we set the date prop of the <WeekNumber /> to first date of the week.  As a result this highlight will work only for the first day of week
@balajis-qb balajis-qb changed the title 🔨 Remove the "react-datepicker__week-number--keyboard-selected" class… Fix #5200: Fix the unnecessary highlight on the Week Number when the first day of the week is selected using Keyboard Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Week number is highlighted when on first day of the week navigating using arrow keys
1 participant