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

Add inputmode option to the input component #1527

Merged
merged 2 commits into from
Aug 27, 2019
Merged

Add inputmode option to the input component #1527

merged 2 commits into from
Aug 27, 2019

Conversation

htmlandbacon
Copy link
Contributor

@htmlandbacon htmlandbacon commented Aug 8, 2019

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

Copy link
Contributor

@36degrees 36degrees left a 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 %}
Copy link
Contributor

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">
Suggested change
{%- if params.inputmode %} inputmode="{{ params.inputmode }}" {% endif %}
{%- if params.inputmode %} inputmode="{{ params.inputmode }}"{% endif %}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good spot, have updated 👍

src/govuk/components/input/template.test.js Outdated Show resolved Hide resolved
@@ -341,4 +348,15 @@ describe('Input', () => {
expect($component.attr('autocomplete')).toEqual('postal-code')
})
})

describe('when it includes an inputmode', () => {
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 adding a test for this 💯

@htmlandbacon
Copy link
Contributor Author

Updated with the comments in mind 👍

Copy link
Contributor

@36degrees 36degrees left a 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.

@NickColley NickColley merged commit 1891865 into alphagov:master Aug 27, 2019
@NickColley
Copy link
Contributor

Thanks Colin :)

@NickColley NickColley added this to the Next milestone Aug 27, 2019
@NickColley NickColley changed the title Adding inputmode option to input component Add ability to set inputmode option for input component Aug 29, 2019
@NickColley NickColley changed the title Add ability to set inputmode option for input component Add inputmode option for input component Aug 29, 2019
@NickColley NickColley changed the title Add inputmode option for input component Add inputmode option to the input component Aug 29, 2019
@NickColley NickColley mentioned this pull request Sep 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Update the date input to use text inputs with a numeric input mode
3 participants