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(input): only set native input value if different #24758

Merged
merged 3 commits into from
Feb 14, 2022
Merged

Conversation

sean-perkins
Copy link
Contributor

@sean-perkins sean-perkins commented Feb 9, 2022

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Build (npm run build) was run locally and any changes were pushed
  • Lint (npm run lint) has passed locally and any fixes were made for failures

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

setSelectionRange isn't supported on all input types and will error when developers use ion-input with a type other than: text, url, search, tel, or password.

Issue Number: #24753

What is the new behavior?

Removes the logic requiring the usage of setSelectionRange and rather only sets the native input value if not composing (using an IME) and if the value is different than the current value).

Fixes error resulting in:

Failed to execute 'setSelectionRange' on 'HTMLInputElement': The input element's type ('number') does not support selection.

Does this introduce a breaking change?

  • Yes
  • No

Other information

@sean-perkins sean-perkins requested a review from a team as a code owner February 9, 2022 17:27
@github-actions github-actions bot added the package: core @ionic/core package label Feb 9, 2022
Copy link
Contributor

@averyjohnston averyjohnston left a comment

Choose a reason for hiding this comment

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

Might want to update the PR name and description, since you're doing something entirely different now. Otherwise, this LGTM; I tried it on Windows Chrome, plus iOS 14 and 15, and couldn't poke any holes besides the behavior you noted here.

@sean-perkins sean-perkins changed the title fix(input): only use selection range on supported types fix(input): only set native input value if different Feb 11, 2022
@sean-perkins
Copy link
Contributor Author

Good call, I've updated both. Not in love with the PR title, but unsure how to best describe it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: core @ionic/core package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants