Skip to content

Conversation

@sean-perkins
Copy link
Contributor

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?

Updating the value of the ion-input during the ionInput event callback, will not be reflected in the control. This means you cannot have functionality such as trimming white spaces from an input.

Issue Number: #19884

What is the new behavior?

The native input is updated when the attribute change callback is fired for the value prop. This forces the input element to always be in sync with the value of the ion-input web component.

This allows implementations such as preventing whitespace in an ion-input.

Does this introduce a breaking change?

  • Yes
  • No

Other information

@sean-perkins sean-perkins requested a review from a team January 20, 2022 03:30
@github-actions github-actions bot added the package: core @ionic/core package label Jan 20, 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.

LGTM! It's interesting that the valueChanged handler has a comment implying this already should've been happening, but I couldn't find anywhere else nativeInput.value is updated. Must've been removed at some point 🤔

Copy link
Contributor

@liamdebeasi liamdebeasi left a comment

Choose a reason for hiding this comment

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

This issue regressed in 4.6, which was when Ionic was updated to the Stencil 1.0.0 release. That update cause quite a few issues, so this could be left over from that change.

Otherwise, I don't see anything else in the 4.6 changelog that would cause this behavior change.

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