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(select,slider,textarea,passwordtoggle): auto generate id [WD-8217] #1020

Merged
merged 1 commit into from
Jan 19, 2024

Conversation

aaryanporwal
Copy link
Contributor

@aaryanporwal aaryanporwal commented Jan 19, 2024

Done

  • This PR modifies the Select, Slider, Textarea, PasswordToggle form input components to automatically generate and assign a unique id when one is not provided. This ensures correct label-input association as per accessibility standards.

  • Replace instances of soon-to-be-deprecated .toHaveErrorMessage with .toHaveAccessibleErrorMessage

  • Replace duplicated id in PasswordToggle component's storybook.

QA

Storybook

To see rendered examples of all react-components, run:

yarn start

QA in your project

from react-components run:

yarn build
npm pack

Install the resulting tarball in your project with:

yarn add <path-to-tarball>

QA steps

  • Import the select,slider,textarea,passwordtoggle components from @canonical/react-components.
  • Render the components without specifying an id.
  • Click on the label.
  • Make sure that the correct form input is in focus.

Fixes

Fixes: #1011

Extends fixes applied in commit a88e811 (PR #1012)

@webteam-app
Copy link

Demo starting at https://react-components-1020.demos.haus

@aaryanporwal aaryanporwal changed the title fix(select,slider,textarea,passwordtoggle): auto generate id fix(select,slider,textarea,passwordtoggle): auto generate id [WD-8217] Jan 19, 2024
@aaryanporwal aaryanporwal requested a review from edlerd January 19, 2024 11:55
Copy link
Contributor

@edlerd edlerd left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for fixing the ids.

@edlerd edlerd merged commit 0d44c0f into canonical:main Jan 19, 2024
8 checks passed
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.

Input does not receive focus on label click without specified ID
3 participants