-
Notifications
You must be signed in to change notification settings - Fork 327
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
Add inputmode option to the input component #1527
Add inputmode option to the input component #1527
Conversation
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.
Thanks, @htmlandbacon 👏
@@ -42,5 +42,6 @@ | |||
{%- if describedBy %} aria-describedby="{{ describedBy }}"{% endif %} | |||
{%- if params.autocomplete %} autocomplete="{{ params.autocomplete}}"{% endif %} | |||
{%- if params.pattern %} pattern="{{ params.pattern }}"{% endif %} | |||
{%- if params.inputmode %} inputmode="{{ params.inputmode }}" {% endif %} |
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.
Minor, but no trailing space before {% endif %}
– this will be followed by either the >
or an attribute, and each attribute includes a leading space.
As it is, the outputted HTML would include an extra space:
…inputmode="decimal" >
…inputmode="decimal" data-attribute="blah">
{%- if params.inputmode %} inputmode="{{ params.inputmode }}" {% endif %} | |
{%- if params.inputmode %} inputmode="{{ params.inputmode }}"{% endif %} |
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.
Good spot, have updated 👍
@@ -341,4 +348,15 @@ describe('Input', () => { | |||
expect($component.attr('autocomplete')).toEqual('postal-code') | |||
}) | |||
}) | |||
|
|||
describe('when it includes an inputmode', () => { |
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.
Thanks for adding a test for this 💯
Updated with the comments in mind 👍 |
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.
This is looking good to me 👍
This needs another review from someone else on the team and then we can get this merged.
Thanks Colin :) |
This adds the option of setting an optional inputmode.
One thing I couldn't see was an example of a check against something that isn't there by default?
I.e if inputmode="{{ params.inputmode }}" wasn't wrapped correctly it would always be there.
Just just added a check, happy to remove, or change if required.
I figured this was an easy step towards improving #1449 (comment)
Closes #1700