-
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(input, textarea): clearOnInput ignores key modifiers #28639
Conversation
Reviewers: This task was completed outside of my sprint work, so sprint work-related PRs take higher priority. |
@@ -16,28 +18,53 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => | |||
await expect(input).toHaveJSProperty('value', 'h'); | |||
}); | |||
|
|||
test('should not clear when enter is pressed', async ({ page }) => { | |||
await page.setContent(`<ion-input value="abc" clear-on-edit="true" aria-label="input"></ion-input>`, config); | |||
test('should not clear the input if it does not have an initial value when typing', async ({ page }) => { |
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.
This new test (and the same textarea test) was copied over from the legacy directory. I accidentally regressed a behavior that only the legacy tests caught. Since the behavior is still relevant for the modern form control syntax, I decided to copy them over so we don't lose test coverage when we remove the legacy form syntax.
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.
Works as intended! Just one comment.
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.
LGTM
Issue number: resolves #28633
What is the current behavior?
In #28005 I introduced a fix that causes "clearOnEdit" to not clear input/textarea when the Tab key was pressed. However, there were several edge cases I missed. For instance, pressing the "shift" key and then the "tab" key would still clear the input because "shift" was not explicitly excluded.
What is the new behavior?
didInputClearOnEdit
is not set totrue
when an ignored key is pressed. Otherwise, pressing an ignored key and then an accepted key would not cause the input to be cleared. For example, pressing "shift", releasing "shift", then pressing "A" should cause the input to still get cleared.Does this introduce a breaking change?
Other information
Playwright bug report for a9f34a5: microsoft/playwright#28495