Skip to content
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

[web][a11y]Delete _childContainerElement #163662

Merged
merged 7 commits into from
Mar 17, 2025

Conversation

hannah-hyj
Copy link
Member

@hannah-hyj hannah-hyj commented Feb 19, 2025

delete _childContainerElement , add the rect compensate and scrolling adjustment to the children

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard

This comment was marked as outdated.

@github-actions github-actions bot added engine flutter/engine repository. See also e: labels. a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) platform-web Web applications specifically labels Feb 19, 2025
@hannah-hyj hannah-hyj changed the title [web][a11y]Delete _childContainerElement [draft][not ready for review yet][web][a11y]Delete _childContainerElement Feb 20, 2025
@hannah-hyj hannah-hyj force-pushed the deletewebcontainer2 branch 2 times, most recently from 819734c to ea98f32 Compare March 7, 2025 23:51
@hannah-hyj hannah-hyj changed the title [draft][not ready for review yet][web][a11y]Delete _childContainerElement [a11y]Delete _childContainerElement Mar 7, 2025
@hannah-hyj hannah-hyj changed the title [a11y]Delete _childContainerElement [web][a11y]Delete _childContainerElement Mar 7, 2025
@hannah-hyj hannah-hyj requested a review from yjbanov March 8, 2025 00:15
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.

Sending some preliminary comments. I still need to wrap my head around the lifecycle of parent-child position updates. I will review that aspect next.


/// Computes the size and position of [element] and, if this element
/// [hasChildren], of [getOrCreateChildContainer].
/// [hasChildren], Computes the parent adjustment for each child.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: s/Computes/computes/

_clearSemanticElementTransform(containerElement);
/// Computes the size and position of children.
void updateChildrenPositionAndSize() {
for (var childOrder in _childrenInTraversalOrder!) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: s/var childOrder/final childIndex/

</sem>''');
}

semantics().semanticsEnabled = false;
});

test('container nodes are transparent and leaf children are opaque hit-test wise', () async {
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 still need this test. The "container nodes" in the description does not refer to the intermediate container elements that you are removing. It refers to SemanticsNode whose only purpose is to contain children and affect their transforms. We want those nodes to be transparent hit-test wise, and we should continue testing for that.

semantics().semanticsEnabled = false;
});

test('containers can be opaque if tappable', () async {
Copy link
Contributor

Choose a reason for hiding this comment

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

This test is still useful for the same reason.

semantics().semanticsEnabled = false;
});

test('container can be opaque if it is a text field', () async {
Copy link
Contributor

Choose a reason for hiding this comment

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

And this one.

@github-actions github-actions bot added the f: scrolling Viewports, list views, slivers, etc. label Mar 8, 2025
@@ -1661,7 +1626,7 @@ class SemanticsObject {
// Trivial case: previous list was empty => just populate the container.
if (_currentChildrenInRenderOrder == null || _currentChildrenInRenderOrder!.isEmpty) {
for (final SemanticsObject child in childrenInRenderOrder) {
containerElement!.append(child.element);
element!.append(child.element);
Copy link
Contributor

@yjbanov yjbanov Mar 12, 2025

Choose a reason for hiding this comment

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

Without the container element could we have a problem with _scrollOverflowElement used by scrollables? This algorithm assumes that it controls all the children of the container. However, SemanticScrollable appends _scrollOverflowElement that this algorithm is unaware of. I think we're OK, since here we only use containerElement.append/insertBefore. For example, we don't use containerElement.children or containerElement.firstChild. However, it might be worth paying attention to. Previously, it was OK, because all children went into the container, and _scrollOverflowElement went into the root element.

Copy link
Member Author

Choose a reason for hiding this comment

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

So _scrollOverflowElement was previously a sibling of containerElement and is now a sibling of children.

I think this is OK since, as you said, we are only using containerElement.append/insertBefore but not containerElement.children.

@hannah-hyj hannah-hyj force-pushed the deletewebcontainer2 branch 2 times, most recently from c7265ef to e0b4cc3 Compare March 13, 2025 21:27
@hannah-hyj hannah-hyj requested a review from yjbanov March 13, 2025 21:47
@hannah-hyj hannah-hyj force-pushed the deletewebcontainer2 branch from fe49219 to 0950aef Compare March 14, 2025 19:50
@github-actions github-actions bot added the a: text input Entering text in a text field or keyboard related problems label Mar 14, 2025
@hannah-hyj hannah-hyj force-pushed the deletewebcontainer2 branch from 52fb340 to c829e2b Compare March 14, 2025 22:26
update tests
update tests

Update semantics_test.dart

Update semantics_text_test.dart

lint
@hannah-hyj hannah-hyj force-pushed the deletewebcontainer2 branch from c829e2b to 35fdfb9 Compare March 17, 2025 17:40
@hannah-hyj hannah-hyj added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 17, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Mar 17, 2025
Merged via the queue into flutter:master with commit 6e74ee4 Mar 17, 2025
169 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Mar 17, 2025
@hannah-hyj hannah-hyj added the revert Autorevert PR (with "Reason for revert:" comment) label Mar 18, 2025
Copy link
Contributor

auto-submit bot commented Mar 18, 2025

A reason for requesting a revert of flutter/flutter/163662 could
not be found or the reason was not properly formatted. Begin a comment with 'Reason for revert:' to tell the bot why
this issue is being reverted.

@auto-submit auto-submit bot removed the revert Autorevert PR (with "Reason for revert:" comment) label Mar 18, 2025
@hannah-hyj
Copy link
Member Author

Reason for revert: google 3 failure

@hannah-hyj hannah-hyj added the revert Autorevert PR (with "Reason for revert:" comment) label Mar 18, 2025
auto-submit bot pushed a commit that referenced this pull request Mar 18, 2025
@auto-submit auto-submit bot removed the revert Autorevert PR (with "Reason for revert:" comment) label Mar 18, 2025
github-merge-queue bot pushed a commit that referenced this pull request Mar 18, 2025
<!-- start_original_pr_link -->
Reverts: #163662
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: hannah-hyj
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: google 3 failure
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: hannah-hyj
<!-- end_original_pr_author -->

<!-- start_reviewers -->
Reviewed By: {yjbanov}
<!-- end_reviewers -->

<!-- start_revert_body -->
This change reverts the following previous change:
delete _childContainerElement , add the rect compensate and scrolling
adjustment to the children

## 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], including [Features
we expect every widget to implement].
- [ ] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

<!-- end_revert_body -->

Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 20, 2025
github-merge-queue bot pushed a commit that referenced this pull request Mar 22, 2025
Reland #163662  with some changes 
1. when a node's role changes and reparenting it, append children to it
 2. Merge optimization from /pull/165352  


fix: #45205 
## 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], including [Features
we expect every widget to implement].
- [ ] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) a: text input Entering text in a text field or keyboard related problems engine flutter/engine repository. See also e: labels. f: scrolling Viewports, list views, slivers, etc. platform-web Web applications specifically
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants