-
Notifications
You must be signed in to change notification settings - Fork 166
LG-5333: Improve error state for countries where phone verification disabled #5619
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
Changes from all commits
315f5a1
97149d9
491e668
5b6bb94
fd0e6d3
5c8a634
9d337fc
432d152
9593ab9
3047d3e
ef343ee
dd42d94
7d6e363
873e984
8342a34
877c7a5
78e57b4
63d9beb
b708fb9
d4f69ef
bad1ec0
d6a9c73
fdd0116
02e5850
5207e7b
38e05ff
d65e43a
ff818d0
4f1ba02
354679c
8bb6434
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| lg-validated-field { | ||
| display: block; | ||
| width: min-content; | ||
| } | ||
|
|
||
| .validated-field__input-wrapper { | ||
| width: max-content; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,3 @@ | ||
| class AccordionComponent < BaseComponent | ||
| renders_one :header | ||
|
|
||
| def initialize | ||
| @target_id = "accordion-#{SecureRandom.hex(4)}" | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| <lg-validated-field> | ||
| <%= content_tag( | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note for future consideration: Not sure if we should want to be populating strings like this, vs. leveraging our existing Webpack string extraction. On one hand, it improves portability of the component to think about how it might be used outside our toolchain, e.g. for design system consideration. On the other hand, it works differently, and loses out on ease-of-use of the Webpack approach. Also worth noting that it probably won't work out of the box as-is unfortunately, because I've found the Webpack plugin is quite naive in how it identifies strings, and isn't very flexible to how Webpack would internally rewrite imports to |
||
| :script, | ||
| error_messages.to_json, | ||
| { | ||
| type: 'application/json', | ||
| class: 'validated-field__error-strings', | ||
| }, | ||
| false, | ||
| ) %> | ||
| <%= f.input( | ||
| name, | ||
| tag_options.deep_merge( | ||
| error: false, | ||
| wrapper_html: { | ||
| class: [*tag_options.dig(:wrapper_html, :class), 'validated-field__input-wrapper'], | ||
| }, | ||
| input_html: { | ||
| class: [*tag_options.dig(:input_html, :class), 'validated-field__input'], | ||
| aria: { | ||
| invalid: false, | ||
| describedby: "validated-field-error-#{unique_id}", | ||
| }, | ||
| }, | ||
| ), | ||
| ) %> | ||
| <%= f.error(name, id: "validated-field-error-#{unique_id}") %> | ||
| </lg-validated-field> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { loadPolyfills } from '@18f/identity-polyfill'; | ||
|
|
||
| loadPolyfills(['custom-elements', 'classlist']) | ||
| .then(() => import('@18f/identity-validated-field')) | ||
| .then(({ ValidatedField }) => customElements.define('lg-validated-field', ValidatedField)); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| class ValidatedFieldComponent < BaseComponent | ||
| attr_reader :form, :name, :tag_options | ||
|
|
||
| alias_method :f, :form | ||
|
|
||
| def initialize(form:, name:, error_messages: {}, **tag_options) | ||
| @form = form | ||
| @name = name | ||
| @error_messages = error_messages | ||
| @tag_options = tag_options | ||
| end | ||
|
|
||
| def error_messages | ||
| { | ||
| valueMissing: t('simple_form.required.text'), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. honestly surprised this camelCase symbol didn't make any of our rubocop linters complain 🤷
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I see a handful of cops related to case naming where camelCase may be considered, though not for hash properties specifically: |
||
| **@error_messages, | ||
| } | ||
| end | ||
| end | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: IE11 doesn't support
min-contentormax-content, but I'd consider this under the realm of progressive enhancement / graceful degradation. Main difference is that the width of the error message won't be constrained to the width of the input.