Skip to content

Conversation

@cathybaptista
Copy link
Contributor

@cathybaptista cathybaptista commented Feb 14, 2025

Summary

On initialization, the combo box used by the time-picker component was ignoring its hint text attributes.

Breaking change

This is not a breaking change.

Related issue

Closes #6315

Changelog Entries Combobox and Time Picker

Preview link

Preview link:
Time Picker using Combo Box with aria-describedby

Problem statement

The combo box used in time picker was not linking any aria-describedby attributes for the "appointment-time-hint" field. As a result, the combo box hint text was not being read by screen readers.

Solution

The aria-describedby text was not being included when the combo box was initialized as part of the time-picker component. It is now initialized and set as an attribute when the input field that is part of the combo box element is created.

Combo boxes use the arria describedby as:

aria-describedby="fruit-hint" (A single value with a single "-".)

Testing and review

Go to time picker component
Ensure is initialized properly, i.e. should be a combo box
Inspect hint text and view ID appointment-time-hint
Search for aria attributes that have the ID
Verify that the appointment-time-hint text is found.

@cathybaptista cathybaptista changed the title cb: add aria-describedby USWDS: [Time Picker] Time Picker Ignores Hint Text Feb 14, 2025
@cathybaptista cathybaptista changed the title USWDS: [Time Picker] Time Picker Ignores Hint Text USWDS: [time-picker] Time Picker Ignores Hint Text Feb 14, 2025
@cathybaptista cathybaptista marked this pull request as ready for review February 17, 2025 23:12
@mahoneycm
Copy link
Contributor

@cathybaptista since the solution is found in the combo-box package, can you update the PR description to match? Currently, it's all scoped to time picker.

@cathybaptista cathybaptista changed the title USWDS: [time-picker] Time Picker Ignores Hint Text USWDS: [time-picker] Combo Box Package used in Time Picker Component Ignores Hint Text Feb 18, 2025
@cathybaptista cathybaptista changed the title USWDS: [time-picker] Combo Box Package used in Time Picker Component Ignores Hint Text USWDS: Combo Box used in Time Picker Component Ignores Hint Text Feb 18, 2025
@cathybaptista
Copy link
Contributor Author

@mahoneycm Good suggestion! I think I've made it clear, I also updated the body of the PR to make it clearer. I have also added two changelogs, one for combo box and one for time picker.

Copy link
Contributor

@amyleadem amyleadem left a comment

Choose a reason for hiding this comment

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

Interested to talk through this one because I am curious about the approach.

In the time picker twig, we explicitly define aria-describedby on the <input> element. This leads me to believe that our expectation has been that users are responsible for manually defining the aria-describedby in their HTML. From there, I also assume that it is our responsibility to make sure that attribute is carried over in the dynamically-generated version of the component.

This PR seems to take a different approach. It looks like it is looking for a hint element with a specific name space and then defines aria-describedby with it. This approach feels a bit opinionated and fragile to me since the assumed naming structure feels rigid and it also sets the value of aria-describedby whether the hint is present or not.

Curious if it is more appropriate to just look for the user-defined aria-describedby then transfer it to the dynamic component. I am coming at this with some assumptions, so let's get on a call and talk through this!

image

@cathybaptista
Copy link
Contributor Author

@amyleadem thank you so much for making the connection on this one! I have added the arria-describedby to the input and modified combobox to pick up the value. :)

ac43e46

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.

USWDS - Bug: Time picker ignores hint text

4 participants