Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

CountryInput and StateInput use CustomControlSelect, which doesn't support a required prop #1848

Closed
Aljullu opened this issue Mar 2, 2020 · 7 comments · Fixed by #1993
Closed
Assignees
Labels
focus: components Work that introduces new or updates existing components. type: enhancement The issue is a request for an enhancement.
Milestone

Comments

@Aljullu
Copy link
Contributor

Aljullu commented Mar 2, 2020

Currently, there is no way to mark Country and State input fields as required, but we would like to do so in the Checkout form. That's because internally they use Gutenberg's <CustomControlSelect>, which can't handle required cases.

@Aljullu Aljullu added the focus: components Work that introduces new or updates existing components. label Mar 2, 2020
@Aljullu Aljullu added this to the Future Release milestone Mar 2, 2020
@Aljullu Aljullu changed the title CountryInput and StateInput should have a 'required' prop CountryInput and StateInput should have a 'required' prop and behave accordingly Mar 3, 2020
@nerrad nerrad added the type: enhancement The issue is a request for an enhancement. label Mar 3, 2020
@Aljullu Aljullu self-assigned this Mar 5, 2020
@Aljullu Aljullu changed the title CountryInput and StateInput should have a 'required' prop and behave accordingly CountryInput and StateInput use CustomControlSelect, which doesn't support a required prop Mar 5, 2020
@Aljullu Aljullu removed their assignment Mar 5, 2020
@mikejolley
Copy link
Member

I'm not sure this issue actually affects us @Aljullu @nerrad Whilst it's true we cannot add a HTML required prop to this field, won't we have validation in place using the Store Notices?

HTML required attributes don't provide a consistent experience across browsers and can easily be bypassed with a little inspector knowledge. I think we need JS based validation on the address fields.

@mikejolley
Copy link
Member

There is no issue I can find for validating fields?

@nerrad
Copy link
Contributor

nerrad commented Mar 9, 2020

HTML required attributes don't provide a consistent experience across browsers and can easily be bypassed with a little inspector knowledge. I think we need JS based validation on the address fields.

Agreed, and it's notable that MDN has no browser compatibility data for this attribute

There is no issue I can find for validating fields?

No, but it is something that will come up as a part of splitting out work from #1780 (*see the notes in the flowchart). Still, it'd be good to create an issue so it's not missed.

@mikejolley
Copy link
Member

@garymurray Flagging this up with you - I don't think I've seen any designs for field validation, and whilst we have notices, it might not be the best solution. e.g. we could add inline validation.

@nerrad
Copy link
Contributor

nerrad commented Mar 10, 2020

I think Gary already did some designs and shared them (but it might have only been in slack) - I'll see if I can find.

@nerrad
Copy link
Contributor

nerrad commented Mar 10, 2020

Okay so this is what was shared by Gary in slack: https://www.figma.com/file/Pfw5Qa1UOw03RiJere3Wlo/Automattic-Components?node-id=4117%3A16532

Related slack convo: p1582022324322700-slack-C8X6Q7XQU

@garymurray
Copy link

@mikejolley yes - the idea was to use inline validation as per those components @nerrad shared above.

@Aljullu Aljullu self-assigned this Mar 18, 2020
@nerrad nerrad modified the milestones: Future Release, 2.6.0 Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
focus: components Work that introduces new or updates existing components. type: enhancement The issue is a request for an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants