This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Commit d721351
authored
[Web] Fix extra new line when inputAction is not newline for a multil… (#53453)
## Description
This PR prevents new line key event from being dispatched for a multiline text field when `TextField.textInputAction` is not `TextInputAction.newline`.
Since #33428, web engine does not prevent new line key events.
In #36893, I fixed a similar issue for single line text fields. At that time I was not sure if we want to fix it for multiline text fields. I checked again on non-web platforms (macos, iOS, Android) and the new line is not added if the input action is not `TextInputAction.newline`.
For a **multiline field**, the default text input action is `TextInputAction.newline`.
If the developer sets text input action to another value:
- before this PR, the action is performed and a new line is added.
- after this PR, the action is performed but no new line is added.
## Related Issue
Fixes flutter/flutter#145051
## Tests
Adds 1 tests, updates 3 tests.1 parent 302798a commit d721351
File tree
2 files changed
+41
-8
lines changed- lib/web_ui
- lib/src/engine/text_editing
- test/engine
2 files changed
+41
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1508 | 1508 | | |
1509 | 1509 | | |
1510 | 1510 | | |
1511 | | - | |
1512 | | - | |
1513 | | - | |
| 1511 | + | |
| 1512 | + | |
1514 | 1513 | | |
| 1514 | + | |
| 1515 | + | |
1515 | 1516 | | |
1516 | 1517 | | |
1517 | 1518 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
494 | 494 | | |
495 | 495 | | |
496 | 496 | | |
497 | | - | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
498 | 526 | | |
499 | 527 | | |
500 | 528 | | |
| |||
520 | 548 | | |
521 | 549 | | |
522 | 550 | | |
523 | | - | |
524 | | - | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
525 | 555 | | |
526 | 556 | | |
527 | 557 | | |
| |||
2542 | 2572 | | |
2543 | 2573 | | |
2544 | 2574 | | |
2545 | | - | |
2546 | | - | |
| 2575 | + | |
| 2576 | + | |
| 2577 | + | |
| 2578 | + | |
2547 | 2579 | | |
2548 | 2580 | | |
2549 | 2581 | | |
| |||
0 commit comments