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

FCT 1207-1224: unique id's for error and warning containers in all -Field components #2950

Merged
merged 3 commits into from
Oct 10, 2024

Conversation

ByronDWall
Copy link
Contributor

Summary

Guarantees unique HTML ID's in FieldErrors and FieldWarnings components. Guarantee unique ID's for error/warning field containers for each -Field component. Is the fix for this bug reported in slack.

Description

The FieldErrors and FieldWarnings components are meant to display error and warning fields. If multiple errors/warnings are passed to the component in the errors/warnings object, the component is meant to display multiple fields. Previously, if props.id was passed to the component, it would be used as the id attribute for each fields. If multiple errors/warnings were passed, each field would have the same id.

This PR updates the FieldErrors and FieldWarnings component so that all fields have a parent wrapper on which the id is set. This insures that the id passed to the component is always unique and refers to all errors/warnings.

Each -Field component is updated so that it builds the id for the errors and warnings containers based on the unique id used for the -Field input. This insures that the id specified in the aria-errormessage attribute for each -Field is unique. Tests added to each -Field component to ensure the id generation works as expected.

There are a lot of components changed, but changes for all -Field components are very similar and so should be fairly straightforward to review.

@ByronDWall ByronDWall self-assigned this Oct 8, 2024
@ByronDWall ByronDWall requested a review from a team as a code owner October 8, 2024 17:25
@ByronDWall ByronDWall requested review from stephsprinkle, jaikamat, ddouglasz, tylermorrisford and misama-ct and removed request for a team October 8, 2024 17:25
Copy link

changeset-bot bot commented Oct 8, 2024

🦋 Changeset detected

Latest commit: cdf8c77

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 98 packages
Name Type
@commercetools-uikit/localized-multiline-text-field Patch
@commercetools-uikit/async-creatable-select-field Patch
@commercetools-uikit/creatable-select-field Patch
@commercetools-uikit/localized-text-field Patch
@commercetools-uikit/multiline-text-field Patch
@commercetools-uikit/search-select-field Patch
@commercetools-uikit/async-select-field Patch
@commercetools-uikit/date-range-field Patch
@commercetools-uikit/date-time-field Patch
@commercetools-uikit/password-field Patch
@commercetools-uikit/number-field Patch
@commercetools-uikit/select-field Patch
@commercetools-uikit/money-field Patch
@commercetools-uikit/radio-field Patch
@commercetools-uikit/date-field Patch
@commercetools-uikit/text-field Patch
@commercetools-uikit/time-field Patch
@commercetools-uikit/field-warnings Patch
@commercetools-uikit/field-errors Patch
@commercetools-uikit/fields Patch
@commercetools-frontend/ui-kit Patch
@commercetools-uikit/design-system Patch
@commercetools-uikit/calendar-time-utils Patch
@commercetools-uikit/calendar-utils Patch
@commercetools-uikit/hooks Patch
@commercetools-uikit/i18n Patch
@commercetools-uikit/localized-utils Patch
@commercetools-uikit/utils Patch
@commercetools-uikit/accessible-hidden Patch
@commercetools-uikit/avatar Patch
@commercetools-uikit/card Patch
@commercetools-uikit/collapsible-motion Patch
@commercetools-uikit/collapsible-panel Patch
@commercetools-uikit/collapsible Patch
@commercetools-uikit/constraints Patch
@commercetools-uikit/data-table-manager Patch
@commercetools-uikit/data-table Patch
@commercetools-uikit/field-label Patch
@commercetools-uikit/filters Patch
@commercetools-uikit/grid Patch
@commercetools-uikit/icons Patch
@commercetools-uikit/label Patch
@commercetools-uikit/link Patch
@commercetools-uikit/loading-spinner Patch
@commercetools-uikit/messages Patch
@commercetools-uikit/notifications Patch
@commercetools-uikit/pagination Patch
@commercetools-uikit/primary-action-dropdown Patch
@commercetools-uikit/progress-bar Patch
@commercetools-uikit/quick-filters Patch
@commercetools-uikit/stamp Patch
@commercetools-uikit/tag Patch
@commercetools-uikit/text Patch
@commercetools-uikit/tooltip Patch
@commercetools-uikit/view-switcher Patch
@commercetools-uikit/accessible-button Patch
@commercetools-uikit/flat-button Patch
@commercetools-uikit/icon-button Patch
@commercetools-uikit/link-button Patch
@commercetools-uikit/primary-button Patch
@commercetools-uikit/secondary-button Patch
@commercetools-uikit/secondary-icon-button Patch
@commercetools-uikit/dropdown-menu Patch
@commercetools-uikit/async-creatable-select-input Patch
@commercetools-uikit/async-select-input Patch
@commercetools-uikit/checkbox-input Patch
@commercetools-uikit/creatable-select-input Patch
@commercetools-uikit/date-input Patch
@commercetools-uikit/date-range-input Patch
@commercetools-uikit/date-time-input Patch
@commercetools-uikit/input-utils Patch
@commercetools-uikit/localized-money-input Patch
@commercetools-uikit/localized-multiline-text-input Patch
@commercetools-uikit/localized-rich-text-input Patch
@commercetools-uikit/localized-text-input Patch
@commercetools-uikit/money-input Patch
@commercetools-uikit/multiline-text-input Patch
@commercetools-uikit/number-input Patch
@commercetools-uikit/password-input Patch
@commercetools-uikit/radio-input Patch
@commercetools-uikit/rich-text-input Patch
@commercetools-uikit/rich-text-utils Patch
@commercetools-uikit/search-select-input Patch
@commercetools-uikit/search-text-input Patch
@commercetools-uikit/select-input Patch
@commercetools-uikit/select-utils Patch
@commercetools-uikit/selectable-search-input Patch
@commercetools-uikit/text-input Patch
@commercetools-uikit/time-input Patch
@commercetools-uikit/toggle-input Patch
@commercetools-uikit/spacings-inline Patch
@commercetools-uikit/spacings-inset-squish Patch
@commercetools-uikit/spacings-inset Patch
@commercetools-uikit/spacings-stack Patch
@commercetools-uikit/buttons Patch
@commercetools-uikit/inputs Patch
@commercetools-uikit/spacings Patch
visual-testing-app Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Oct 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ui-kit ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 10, 2024 1:04pm

Copy link
Contributor

@tdeekens tdeekens left a comment

Choose a reason for hiding this comment

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

Looks really better than the first approach! Thanks for working through the monoton changes on all components!

Copy link
Contributor

@tdeekens tdeekens left a comment

Choose a reason for hiding this comment

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

This nicely fixes the broken setup we have. I liked @misama-ct suggestion around using :invalid. Maybe an investigation can be a followup if we can use it.

…r the passed id on the wrapper container isntead of on the container for each message so that all errors/warnings can be referred to by aria-errormessage using a single id, update all -Field components to build the id's for their error and warning containers based on their unique id, update tests
@ByronDWall ByronDWall force-pushed the FCT-1207-1224-unique-error-ids branch from 9e5d8e6 to cdf8c77 Compare October 10, 2024 12:56
@ByronDWall ByronDWall enabled auto-merge (squash) October 10, 2024 12:58
@ByronDWall ByronDWall merged commit c41a012 into main Oct 10, 2024
6 of 7 checks passed
@ByronDWall ByronDWall deleted the FCT-1207-1224-unique-error-ids branch October 10, 2024 13:03
@ct-changesets ct-changesets bot mentioned this pull request Oct 10, 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.

3 participants