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: fix bug where required fields were not being enforced #8455

Conversation

eddiekeller
Copy link
Contributor

Description of changes

Previously, if a user added custom form fields and wanted them to be "required", they weren't actually being enforced as required fields. This PR changes that by adding the required prop to our amplify-input, which generates the actual input field on the page.

It also moves the required prop from the parent amplify-form-field component in the phone form field to the text input field, as having the required on the top level actually didn't enforce it properly and sometimes caused a bug where the form field was untargettable.

Issue #, if available

#6885

Description of how you validated changes

Test locally in UI. GIF showing how it works -

out

Checklist

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov-commenter
Copy link

codecov-commenter commented Jun 15, 2021

Codecov Report

Merging #8455 (8f5ec38) into main (1ba2a1f) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #8455   +/-   ##
=======================================
  Coverage   77.79%   77.79%           
=======================================
  Files         236      236           
  Lines       16682    16682           
  Branches     3581     3581           
=======================================
  Hits        12978    12978           
  Misses       3576     3576           
  Partials      128      128           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1ba2a1f...8f5ec38. Read the comment docs.

@@ -132,6 +134,7 @@ export class AmplifyInput {
class="input"
value={this.value}
disabled={this.disabled}
required={this.required}
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for patching this! Such a small, easy thing that customers expected to be there by default.

You're the best @eddiekeller !

@github-actions
Copy link

This pull request has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants