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): Add support for required attribute #1110

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kaiweike
Copy link

@kaiweike kaiweike commented Jul 30, 2024

Done

  • Implemented the required attribute in the Select component, ensuring it is correctly passed down to the <select> element.
  • Updated the Storybook documentation to include examples demonstrating the use of the required attribute.
  • Added tests to confirm that the required attribute behaves as expected, both when set and not set.

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

  1. Render the Select component with the required attribute.
  2. Attempt to submit a form without selecting an option, ensuring the form validation prevents submission.
  3. Verify that removing the required attribute allows the form to be submitted without selecting an option.

Percy steps

  • No visual changes expected

Fixes

Fixes: #1045

@webteam-app
Copy link

kaiweike is not a collaborator of the repo

Copy link

This PR is being prevented from merging because it needs to be reviewed on Percy.

Go to Percy, find the build relevant to this PR and check if it looks as expected.

Once it's approved, add the label Review: Percy +1 to this PR.

@kaiweike
Copy link
Author

This PR is being prevented from merging because it needs to be reviewed on Percy.

Go to Percy, find the build relevant to this PR and check if it looks as expected.

Once it's approved, add the label Review: Percy +1 to this PR.

I encountered an "Access Denied" issue while trying to access the Percy test results. It seems I don't have the necessary permissions. Could someone please assist with granting me the appropriate access? Thank you!

Copy link
Collaborator

@huwshimi huwshimi left a comment

Choose a reason for hiding this comment

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

There are some lint failures on this PR.

@@ -119,3 +125,43 @@ export const SelectMultiple: Story = {

name: "Select multiple",
};

export const RequiredSelect: Story = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this prop requires an isolated example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Select: form validation with required attribute
3 participants