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 support for other "text-like" input types to TextInput #189

Merged
merged 1 commit into from
Sep 9, 2021

Conversation

lyzadanger
Copy link
Contributor

When working on converting LMS' URLPicker over to use the shared Modal, I was also wanting to convert it to use TextInput for its URL-input field. However, URLPicker relies on browser validation on input type="url", and TextInput wasn't allowing any type except text.

This PR adds support for the most "text-like" input types, per https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input — we could open this up to more in the future if we wanted.

@lyzadanger lyzadanger requested a review from esanzgar September 8, 2021 17:39
Copy link
Contributor

@esanzgar esanzgar left a comment

Choose a reason for hiding this comment

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

👍🏼

@@ -9,13 +9,12 @@ import classnames from 'classnames';
* the rendered `input` element.
* @prop {boolean} [hasError] - There is an error associated with this input. Will
* set some error styling.
* @prop {'email'|'search'|'text'|'url'} [type="text"] - Set the <input> type:
Copy link
Contributor

Choose a reason for hiding this comment

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

We could add 'password' too (while not having a specific component for that).

Something to notice about the 'search' is that in Chrome it adds a 'X' cancel symbol. I am not sure if we mind that:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/search#differences_between_search_and_text_types

@lyzadanger lyzadanger merged commit d02b448 into main Sep 9, 2021
@lyzadanger lyzadanger deleted the input-type branch September 9, 2021 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants