Skip to content

fix(input, textarea): clearOnEdit does not clear when pressing Tab - #28005

Merged
liamdebeasi merged 6 commits into
mainfrom
FW-4668
Aug 18, 2023
Merged

liamdebeasi merged 6 commits into
mainfrom
FW-4668

Conversation

@liamdebeasi

@liamdebeasi liamdebeasi commented Aug 16, 2023 •

Copy link
Copy Markdown
Contributor

Issue number: resolves #27746


What is the current behavior?

Pressing the Tab key when focused on an input/textarea with clearOnEdit clears the text field and then moves focus to the next focusable element.

What is the new behavior?

  • Pressing the Tab key does not clear the text field even when clearOnEdit is enabled.
  • Added test coverage
  • I also noticed that input did not have an index.html file in the basic directory, so I added that.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Dev build: 7.3.1-dev.11692202566.13cd16c4

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@liamdebeasi liamdebeasi changed the title Fw 4668 fix(input, textarea): text field does not clear when pressing Tab with clearOnEdit Aug 16, 2023
@github-actions github-actions Bot added the package: core @ionic/core package label Aug 16, 2023
@liamdebeasi liamdebeasi changed the title fix(input, textarea): text field does not clear when pressing Tab with clearOnEdit fix(input, textarea): clearOnEdit does not clear when pressing Tab Aug 16, 2023
@liamdebeasi
liamdebeasi marked this pull request as ready for review August 16, 2023 16:25
@liamdebeasi
liamdebeasi requested review from a team and brandyscarney and removed request for a team August 16, 2023 16:25

@brandyscarney brandyscarney left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good! Nice fix and addition of tests. 👍

@liamdebeasi
liamdebeasi added this pull request to the merge queue Aug 18, 2023
Merged via the queue into main with commit 444acc1 Aug 18, 2023
@liamdebeasi
liamdebeasi deleted the FW-4668 branch August 18, 2023 17:27
github-merge-queue Bot pushed a commit that referenced this pull request Dec 11, 2023
Issue number: resolves #28633

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

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?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Input and textarea now explicitly ignores modifier keys that do not
change the value of the input
- `didInputClearOnEdit` is not set to `true` 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.
- Added test coverage

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

Playwright bug report for
a9f34a5:
microsoft/playwright#28495
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.

bug: clearOnEdit should not clear input when tabbing to next input

2 participants