Skip to content

Conversation

@m-muhsin
Copy link
Collaborator

@m-muhsin m-muhsin commented Dec 1, 2025

image

All Submissions:

  • Does your code follow the WooCommerce Sniffs variant of WordPress coding standards?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?
  • Will this change require new documentation or changes to existing documentation?

Changes proposed in this Pull Request:

This PR enhances the accessibility and visual clarity of the accommodation booking datepicker by:

  1. Accessibility Improvements:

    • Introduced visually hidden text for screen readers to enhance accessibility for datepicker cells
    • Implemented addAccessibleText() function to dynamically add screen reader announcements to date cells
    • Created formatDateForScreenReader() function to format dates in a human-readable format (e.g., "January 15, 2025, Monday") for screen reader users
    • Added contextual announcements for different date availability states:
      • "Available for check-out only" for dates that can only be used as check-out dates
      • "Available for check-in only" for dates that can only be used as check-in dates
      • "Fully booked and unavailable" for dates that cannot be used for either check-in or check-out
  2. Visual Enhancements:

    • Updated styles for fully booked dates to include visual indicators (cross/X marks) using CSS pseudo-elements (::before and ::after)
    • Added diagonal slash indicators for partially available dates:
      • Top-left to bottom-right slash for check-out only dates
      • Top-right to bottom-left slash for check-in only dates
    • Improved contrast and styling for unavailable dates with black background and white text
    • Adjusted opacity for partially available dates to 0.65 for better visual distinction
  3. Technical Implementation:

    • Added .screen-reader-text CSS class following WordPress accessibility standards for visually hidden content
    • Ensured that screen reader text is re-added after date selection triggers a refresh using a timeout mechanism
    • Maintained backward compatibility with existing datepicker functionality

Fixes the following accessibility issues:

WooExt-330.

Closes #553
Closes https://linear.app/a8c/issue/WOOACBK-76/tracking-issue-for-pr-550-add-screen-reader-accessibility-features-to

Steps to test the changes in this Pull Request:

  1. Navigate to a product page with an Accommodation Booking product type
  2. Open the booking datepicker calendar
  3. Test visual indicators:
    • Verify that fully booked dates (unavailable for both check-in and check-out) display with a black background and white X/cross indicator
    • Verify that partially available dates show diagonal slashes:
      • Dates available only for check-out show a slash from top-left to bottom-right
      • Dates available only for check-in show in a dark gray background.
  4. Test accessibility with screen reader:
    • Enable a screen reader
    • Navigate through the datepicker calendar using keyboard navigation
    • Verify that each date cell announces:
      • The full date (month, day, year, day of week)
      • The availability status (check-in only, check-out only, or fully booked)
  5. Test date selection flow:
    • Select a check-in date and verify that the datepicker refreshes correctly
    • Verify that screen reader announcements persist after date selection
    • Verify that visual indicators remain correct after selection
  6. Test with different date availability scenarios:
    • Test with dates that are fully booked
    • Test with dates that are partially available (check-in only or check-out only)
    • Verify that the appropriate visual and accessibility indicators appear for each state

Changelog entry

Add - Enhanced datepicker accessibility with screen reader support and improved visual indicators for booking availability status.

- Introduced visually hidden text for screen readers to enhance accessibility for datepicker cells.
- Implemented functions to format and add accessible text for fully booked and partially available dates.
- Updated styles for fully booked dates to include visual indicators (crosses) for better user experience.
- Ensured that screen reader text is re-added after date selection triggers a refresh.
@github-actions
Copy link

github-actions bot commented Dec 1, 2025

This is linked to GitHub issue #551.

@github-actions
Copy link

github-actions bot commented Dec 1, 2025

This is linked to GitHub issue #552.

@github-actions
Copy link

github-actions bot commented Dec 1, 2025

This is linked to GitHub issue #553.

@m-muhsin m-muhsin self-assigned this Dec 1, 2025
@m-muhsin m-muhsin requested a review from iamdharmesh December 1, 2025 01:51
@m-muhsin m-muhsin changed the title Add screen reader accessibility features to datepicker Add partial check-in/check-out indicators and screen reader accessibility features to datepicker Dec 1, 2025
Copy link
Collaborator

@iamdharmesh iamdharmesh left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @m-muhsin. Added few questions could you please check. Thanks

*/
const formatDateForScreenReader = ($cell) => {
const $dayElement = $cell.find('span, a').first();
const day = $dayElement.contents().first().text().trim();
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about add formatted date attribute and use that directly instead of parsing content and generate it?

@iamdharmesh iamdharmesh requested a review from dkotter December 1, 2025 08:11
@m-muhsin m-muhsin requested a review from iamdharmesh December 5, 2025 11:40
Copy link
Collaborator

@iamdharmesh iamdharmesh left a comment

Choose a reason for hiding this comment

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

Thanks for the changes @m-muhsin. Added note around formattedDate not getting added. Could you please help to check? Also, Eslint action is getting failed, would be great if you can fix the reported errors there as well. Thanks.

Muhammad Muhsin added 2 commits December 10, 2025 08:39
…date formatting by robustly retrieving date components, and refine `addAccessibleText` targeting.
@m-muhsin m-muhsin requested a review from iamdharmesh December 11, 2025 08:31
Copy link
Collaborator

@iamdharmesh iamdharmesh left a comment

Choose a reason for hiding this comment

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

Thanks for the changes @m-muhsin. It looks good now. Just waiting for conclude on this, once done. we are good to go.

Btw, this is fix for "WooExt-330" right? If yes, could you please update PR description. Thanks.

@m-muhsin
Copy link
Collaborator Author

Btw, this is fix for "WooExt-330" right? If yes, could you please update PR description. Thanks.

Yes, correct. I have updated accordingly. Thank you.

@vikrampm1
Copy link
Collaborator

@m-muhsin is there is anything pending here or did you address all the feedback above? If yes, can you re-request review to @iamdharmesh so this can be progressed further?

…visual indicators and updated gradients for availability representation.
@m-muhsin
Copy link
Collaborator Author

Hi @vikrampm1. We had a discussion around this in yesterday's call. We decided to implement it like this:

image

I have done it likewise now.

Thanks!

@vikrampm1
Copy link
Collaborator

@m-muhsin it would be great to get these addressed soon so we can move this to the next step. Thanks!

Co-authored-by: Dharmesh Patel <[email protected]>
@m-muhsin
Copy link
Collaborator Author

@iamdharmesh I have now incorporated your feedback. Thanks!

CC: @vikrampm1

@m-muhsin m-muhsin requested a review from iamdharmesh December 22, 2025 20:21
@iamdharmesh
Copy link
Collaborator

Thanks for the changes @m-muhsin. Changes looks good. However, I noticed that accessibility text not getting added on months other than current. Example: It works fine for current month (Dec) but not for the January

@iamdharmesh
Copy link
Collaborator

@m-muhsin Reminder for addressing this.

@m-muhsin
Copy link
Collaborator Author

m-muhsin commented Jan 6, 2026

Thanks for the reminder, @iamdharmesh. I was trying to replicate it but could not. I even checked for 2027 just in case it was for the following year.

image

@iamdharmesh
Copy link
Collaborator

Note: As discussed over call UI part is work well but accessibility text not getting added on months other than current. Thanks.

Muhammad Muhsin added 2 commits January 6, 2026 20:57
…o that it applies to other months than the current month alone.
@m-muhsin
Copy link
Collaborator Author

m-muhsin commented Jan 7, 2026

@iamdharmesh I have now added even listeners to change of month. So, the last reported issue is now sorted. Thanks!

'change',
'.ui-datepicker-month, .ui-datepicker-year',
function () {
setTimeout(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need this setTimeout? If we don't have proper event to tag this then we might look into fix the issues in bookings itself if that's more solid way to fix this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It was required for when testing with a throttled network. I have removed it now. Shall we address it upstream if it comes again?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@iamdharmesh as discussed I added the setTimeout back along with a comment explaining it.

@iamdharmesh
Copy link
Collaborator

Thanks for fixing it @m-muhsin. Added one question to get some information.

@m-muhsin
Copy link
Collaborator Author

@iamdharmesh as mentioned, in this comment, can we address it in upstream if it comes up again? I removed the setTimeout which is required for slower networks.

@m-muhsin m-muhsin requested a review from iamdharmesh January 14, 2026 10:46
@m-muhsin
Copy link
Collaborator Author

@iamdharmesh I felt better to add the setTimeout so did it with a comment explaining it.

@m-muhsin m-muhsin changed the title Add partial check-in/check-out indicators and screen reader accessibility features to datepicker Add partial check-in/check-out indicators and screen reader accessibility features to datepicker (WooExt-330) Jan 14, 2026
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.

A11y: Status relies on color alone, not programatically defined (WooExt-330)

5 participants