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

feat: improve accessibility for single field components tckt-393 #387

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

Conversation

kalasgarov
Copy link
Contributor

Addressed some accessibility issues for single field components.
Improved error handling for single field components.

Copy link

github-actions bot commented Nov 20, 2024

Terraform plan for tts-10x-atj-dev

Plan: 0 to add, 2 to change, 0 to destroy.
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
!~  update in-place

Terraform will perform the following actions:

  # cloudfoundry_app.tts-10x-atj-dev-server-doj_tts-10x-atj-dev-server-doj-app_380DB029 will be updated in-place
!~  resource "cloudfoundry_app" "tts-10x-atj-dev-server-doj_tts-10x-atj-dev-server-doj-app_380DB029" {
!~      docker_image                    = "ghcr.io/gsa-tts/forms/server-doj:47ea8ce4d918a6c2e82782097e07eb1aba09d078" -> "ghcr.io/gsa-tts/forms/server-doj:0aa87c95543c9d835bd1d9ab5cb731513490e3a8"
        id                              = "8a9fc8b6-af5e-45a2-abb6-2c24ecbcdfaa"
        name                            = "tts-10x-atj-dev-server-doj-app"
#        (17 unchanged attributes hidden)

#        (3 unchanged blocks hidden)
    }

  # cloudfoundry_app.tts-10x-atj-dev-server-kansas_tts-10x-atj-dev-server-kansas-app_337A9CF1 will be updated in-place
!~  resource "cloudfoundry_app" "tts-10x-atj-dev-server-kansas_tts-10x-atj-dev-server-kansas-app_337A9CF1" {
!~      docker_image                    = "ghcr.io/gsa-tts/forms/server-kansas:47ea8ce4d918a6c2e82782097e07eb1aba09d078" -> "ghcr.io/gsa-tts/forms/server-kansas:0aa87c95543c9d835bd1d9ab5cb731513490e3a8"
        id                              = "e885e531-11b7-4906-9cc3-0ddf483868f5"
        name                            = "tts-10x-atj-dev-server-kansas-app"
#        (17 unchanged attributes hidden)

#        (3 unchanged blocks hidden)
    }

Plan: 0 to add, 2 to change, 0 to destroy.

📝 Plan generated in Post Terraform plan to PR comment #450

@kalasgarov kalasgarov self-assigned this Nov 20, 2024
Copy link
Contributor

@ethangardner ethangardner left a comment

Choose a reason for hiding this comment

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

I really appreciate you taking the time to do this! I left some comments for you on this one. The changes are minor tweaks to the aria labels, so I don't need to review again and can trust you to make the changes. I'll give it a conditional approval as long as the changes are implemented. Just merge it when the changes are complete.

id={monthId}
{...register(monthId)}
aria-describedby="mdHint"
aria-describedby={
error ? `${monthId} input-error-message-${monthId}}` : monthId
Copy link
Contributor

Choose a reason for hiding this comment

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

I left a comment for you on your other PR about the logic for the aria-describedby attribute. The same comment is true here where I think you'll want to have 4 branches of a conditional - error only, hint only, both error and hint, neither error nor hint.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the comments!
Updated this PR accordingly.

id={dayId}
{...register(dayId)}
minLength={2}
maxLength={2}
pattern="[0-9]*"
inputMode="numeric"
aria-describedby={
Copy link
Contributor

Choose a reason for hiding this comment

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

This is described by hint-${monthId} as well. You'll have identical aria-describedby logic for all 3 form fields, so you many want to make a function for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea! Updated!

id={yearId}
{...register(yearId)}
minLength={4}
maxLength={4}
pattern="[0-9]*"
inputMode="numeric"
aria-describedby={
error ? `${yearId} input-error-message-${yearId}}}` : yearId
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as my comment above.

id={emailId}
type="email"
autoCapitalize="off"
autoCorrect="off"
{...register(emailId, { required })}
aria-describedby={error ? `${emailId} ${errorId}}` : emailId}
Copy link
Contributor

Choose a reason for hiding this comment

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

The emailId can be safely removed.

@@ -49,7 +46,7 @@ export const PhoneNumberPattern: PatternComponent<PhoneNumberProps> = ({
type="tel"
defaultValue={value}
{...register(phoneId, { required })}
aria-describedby="primaryPnHint"
aria-describedby={error ? `${phoneId} ${errorId}` : phoneId}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as before with the 4 branches of the conditional.

})}
id={selectId}
{...register(selectId, { required })}
aria-describedby={error ? `${selectId} ${errorId}` : selectId}
Copy link
Contributor

Choose a reason for hiding this comment

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

selectId can be safely removed from this.

@kalasgarov kalasgarov changed the title feat: improve accessibility for single field components tckt-000 feat: improve accessibility for single field components tckt-393 Nov 27, 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.

2 participants