Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[web] Don't overwrite editing state with semantic updates #38271

Merged
merged 8 commits into from
Dec 19, 2022

Conversation

htoor3
Copy link
Contributor

@htoor3 htoor3 commented Dec 13, 2022

We currently handle syncing text input editing state updates in 2 places: text_editing.dart (non-semantic path) and text_field.dart (semantic mode path). This redundancy is causing several text input issues in semantic mode, especially as it relates to text field value and selection state. Delegating this responsibility solely to text_editing.dart will fix this.

Fixes flutter/flutter#107634
Fixes flutter/flutter#90794

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides].
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See [testing the engine] for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the [CLA].
  • All existing and new tests are passing.

@flutter-dashboard flutter-dashboard bot added the platform-web Code specifically for the web engine label Dec 13, 2022
@@ -159,7 +159,6 @@ void testMain() {
expect(domDocument.activeElement, flutterViewEmbedder.glassPaneElement);
expect(appHostNode.activeElement, strategy.domElement);
expect(textField.editableElement, strategy.domElement);
expect((textField.editableElement as dynamic).value, 'hello');
Copy link
Contributor

Choose a reason for hiding this comment

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

This expectation used to verify that the semantics text value gets updated when the framework begins editing a text field. I think to cover that with the new approach we need a new test (or maybe just add it to this test) that sends the text editing state through the text input channel and checks that the editing state is applied to textField.editableElement.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a good point. I wrote it this way because we're delegating the responsibility of editing state updates to text_editing.dart, so it seems like the best place to test framework -> engine editing state updates would be in text_editing_test.dart which has existing tests that verify that behavior.

But is the idea here that we want to explicitly test whether that behavior applies specifically to semantic nodes?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we want to test the behavior of text_editing.dart when using a semantics editing strategy to make sure that the element's value is still being updated correctly.

});

test(
'Updates editing state when receiving framework messages from the text input channel',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Perfect! Thanks.

Copy link
Contributor

@mdebbar mdebbar left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@nbayati nbayati left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@yjbanov yjbanov left a comment

Choose a reason for hiding this comment

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

lgtm

@htoor3 htoor3 added the autosubmit Merge PR when tree becomes green via auto submit App label Dec 19, 2022
@auto-submit auto-submit bot merged commit 45713ea into flutter:main Dec 19, 2022
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Dec 19, 2022
…117330)

* 4a3a0ec67 pylint scripts under sky, remove dead scripts under sky/tools/roll (flutter/engine#38334)

* 45713ea10 [web] Don't overwrite editing state with semantic updates (flutter/engine#38271)
XilaiZhang added a commit that referenced this pull request Dec 29, 2022
auto-submit bot pushed a commit that referenced this pull request Dec 29, 2022
loic-sharma pushed a commit to loic-sharma/flutter-engine that referenced this pull request Jan 3, 2023
)

* Remove editing state overwrite on semantic updates

* Add tests

* Fix test name

* Assert that framework messages will update semantic editing state

* Change test name

* Whitespace
loic-sharma pushed a commit to loic-sharma/flutter-engine that referenced this pull request Jan 3, 2023
htoor3 added a commit that referenced this pull request Jan 13, 2023
auto-submit bot pushed a commit that referenced this pull request Jan 17, 2023
gspencergoog pushed a commit to gspencergoog/flutter that referenced this pull request Jan 19, 2023
…lutter#117330)

* 4a3a0ec67 pylint scripts under sky, remove dead scripts under sky/tools/roll (flutter/engine#38334)

* 45713ea10 [web] Don't overwrite editing state with semantic updates (flutter/engine#38271)
ricardoamador pushed a commit to ricardoamador/engine that referenced this pull request Jan 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
autosubmit Merge PR when tree becomes green via auto submit App platform-web Code specifically for the web engine
Projects
None yet
4 participants