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

Accessibility: Add semantics to textInput #331

Conversation

imgiseverything
Copy link
Contributor

@imgiseverything imgiseverything commented Jan 13, 2025

  1. Adds role of textbox to textInput so screen-readers are told it is a text input
    2. Adds tabindex="0" to textInput so keyboard users can tab to it
  2. Adds aria-label to textInput so screen-reader users know what it does

All the above are because of limitations with being unable to add an input element and/or a label.

note about tabindex

I opted not to add tabindex=0 because I noticed in our implementation on eurostar.com that this seemed to stop the focus styling from working on the #text-input-container element. Plus there seems to be some work in place to allow the div to receive focus already so I felt it was not needed

#285

1. Adds role of textbox to textInput so screen-readers are told it is a text input
~2. Adds tabindex="0" to textInput so keyboard users can tab to it~
3. Adds aria-label to textInput so screen-reader users know what it does

All the above are because of limitations with being unable to add an `input` element and/or a `label`.

OvidijusParsiunas#285
@OvidijusParsiunas OvidijusParsiunas self-assigned this Jan 13, 2025
@OvidijusParsiunas OvidijusParsiunas added the enhancement New feature or request label Jan 13, 2025
@OvidijusParsiunas
Copy link
Owner

@imgiseverything
The text input element is a little tricky because it uses the contenteditable attribute, hence it can behave a little strangely -especially on other browsers. Thankyou for taking that into consideration, this PR is perfect!

@OvidijusParsiunas OvidijusParsiunas merged commit e5dcd44 into OvidijusParsiunas:main Jan 13, 2025
1 check passed
@imgiseverything imgiseverything deleted the a11y/add-semantics-to-input-button branch January 14, 2025 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants