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(datetimepicker): resolve issue with active cell highlighting #381

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

bah99
Copy link

@bah99 bah99 commented Dec 12, 2024

  • Enhanced rendering and performance by updating the @for track function in calendar-body.html.
  • Streamlined active cell and date selection handling in month-view.html for a more efficient user experience.
  • Added _getActiveCell method in month-view.ts to prioritize highlighting of the selected date or today's date when no date is selected in the calendar view.

}
</tr>
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new empty line

(@slideCalendar.done)="_calendarStateDone()"
[@slideCalendar]="_calendarState"
[rows]="_weeks"
[todayValue]="_todayDate!"
[activeCell]="_adapter.getDate(activeDate) - 1"
[activeCell]="_getActiveCell()"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The active cell logic has no issue, we just should improve the a11y.
https://github.com/angular/components/blob/main/src/material/datepicker/month-view.html#L25

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I figured it out! Material has implemented a11y very effectively.

Mamadou BAH and others added 3 commits December 17, 2024 16:47
- Update `_dateButtonText` to show the selected date when a date is chosen
- Fall back to displaying today's date if no date selected or when navigating between months/years
- Ensure consistent and intuitive date display behavior
@bah99
Copy link
Author

bah99 commented Dec 17, 2024

I’m working to improve accessibility by implementing the same approach as the Material Date Picker and ensuring it functions in a similar way.

Mamadou BAH added 4 commits December 18, 2024 16:26
- Implement behavior similar to Angular Material datepicker for keyboard navigation
- Disable arrow key date selection after user clicks next/previous month
- Re-enable arrow key navigation when user selects a specific date
- Add `_nextOrPreviousManuallyClicked` variable in `calendar.ts` to track navigation state
- Pass navigation state to month-view component via @input() decorator
- Implement behavior similar to Angular Material datepicker for keyboard navigation
- Disable arrow key date selection after user clicks next/previous month
- Re-enable arrow key navigation when user selects a specific date
- Add `_nextOrPreviousManuallyClicked` variable in `calendar.ts` to track navigation state
- Pass navigation state to month-view component via @input() decorator
- Implement behavior similar to Angular Material datepicker for keyboard navigation
- Disable arrow key date selection after user clicks next/previous month
- Re-enable arrow key navigation when user selects a specific date
- Add `_nextOrPreviousManuallyClicked` variable in `calendar.ts` to track navigation state
- Pass navigation state to month-view component via @input() decorator
@bah99
Copy link
Author

bah99 commented Dec 18, 2024

Hello @nzbin ,

I've successfully implemented a behavior similar to the Angular Material datepicker navigation. Currently, this is implemented for the month view (type='date').

Could you please review the implementation and provide your feedback? If it meets the requirements, I'll extend the same approach to the year and multi-year views.

Looking forward to your thoughts!

@nzbin
Copy link
Member

nzbin commented Dec 20, 2024

Hello @nzbin ,

I've successfully implemented a behavior similar to the Angular Material datepicker navigation. Currently, this is implemented for the month view (type='date').

Could you please review the implementation and provide your feedback? If it meets the requirements, I'll extend the same approach to the year and multi-year views.

Looking forward to your thoughts!

Do you check the Angular Material source codes? You need the CDK a11y module to implement and there're lots of work.
https://github.com/angular/components/blob/9f73fed4702f79a6461fd2cf86ecb311c9530a78/src/material/datepicker/calendar.html#L3
https://github.com/angular/components/blob/9f73fed4702f79a6461fd2cf86ecb311c9530a78/src/material/datepicker/calendar-body.scss#L286

@bah99
Copy link
Author

bah99 commented Dec 20, 2024

Hello @nzbin ,
I've successfully implemented a behavior similar to the Angular Material datepicker navigation. Currently, this is implemented for the month view (type='date').
Could you please review the implementation and provide your feedback? If it meets the requirements, I'll extend the same approach to the year and multi-year views.
Looking forward to your thoughts!

Do you check the Angular Material source codes? You need the CDK a11y module to implement and there're lots of work. https://github.com/angular/components/blob/9f73fed4702f79a6461fd2cf86ecb311c9530a78/src/material/datepicker/calendar.html#L3 https://github.com/angular/components/blob/9f73fed4702f79a6461fd2cf86ecb311c9530a78/src/material/datepicker/calendar-body.scss#L286

Yes, sometimes. I realized that using the a11y module would require significant time and effort, so I implemented a solution that achieves the same behavior in a simpler way.

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.

3 participants