-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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(textarea): clearOnEdit clears textarea when user initially types #26006
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.
The changes here look good, although this component has the same issues(?) as ion-input
where keys like Ctrl and Shift that don't actually "type" anything can clear the textarea and fire an ionInput
event with null
. Not sure if intended 🤔
@amandaejohnston does that same behavior happen against We would likely need to discuss if we wanted to change that behavior to exclude modifier keys and update the design doc. |
On |
On We need to offer developers an event pattern to migrate to, so that they can respond to the texarea (or input; applies to both) is cleared. That is where |
In that case, there are a few problems with the
1 and 2 mean that an |
🤔 as long as an event is being emitted, developers can check the target's value to determine if the control is cleared. e.g.: onIonInput(ev) {
if (ev.target.value === '') {
// control value is empty
}
} I'll update the documentation around For the inconsistencies around the event detail of We can pass along the |
My main concern is that |
I updated the implementation so that I think excluding certain keys would be out of scope here. We should wait until a use case is reported that needs to ignore shift, ctrl, etc. from clearing the field; as this is currently the behavior on |
Works for me 👍 I'm guessing the input component will need to be updated similarly but that looks good for this PR. |
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.
Changes look good. Can we backport any of this discussion to the design doc for future reference?
Pull request checklist
Please check if your PR fulfills the following requirements:
ionic-docs
repo, in a separate PR. See the contributing guide for details.npm run build
) was run locally and any changes were pushednpm run lint
) has passed locally and any fixes were made for failuresPull request type
Please check the type of change your PR introduces:
What is the current behavior?
The
ion-textarea
field does not initially clear whenclearOnEdit
is enabled, with a default value, when the control is first focused and modified.ionInput
can emit an detail of undefined.Issue URL: Internal
What is the new behavior?
ion-textarea
withclearOnEdit
enabled will clear the textarea when the control receives focus and is modifiedDoes this introduce a breaking change?
Other information