flutter icon indicating copy to clipboard operation
flutter copied to clipboard

synchronously flush semantics when semantics is enabled

Open chunhtai opened this issue 6 months ago • 4 comments

This is an attempt to reduce initial data delay when android or iOS tries to query semantics tree.

Pre-launch Checklist

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

chunhtai avatar Jun 04 '25 19:06 chunhtai

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

flutter-dashboard[bot] avatar Jun 04 '25 19:06 flutter-dashboard[bot]

I am pretty sure something will be broken, just that we don't have good semantics test coverage on this part. will add more test.

@jonahwilliams would like to get your opinion first to see if this is something we should do

chunhtai avatar Jun 05 '25 20:06 chunhtai

Sorry I missed this completely. I'm not certain why we wouldn't do this, though I admit I haven't looked at this code in a while

jonahwilliams avatar Jun 11 '25 15:06 jonahwilliams

Sorry I missed this completely. I'm not certain why we wouldn't do this, though I admit I haven't looked at this code in a while

Agree, will ping again after appropriate tests are added

chunhtai avatar Jun 12 '25 22:06 chunhtai

@chunhtai Do you need a new reviewer here?

justinmc avatar Aug 05 '25 22:08 justinmc

This is not yet ready, I will try to get to this pr soon

chunhtai avatar Aug 05 '25 23:08 chunhtai

This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

flutter-dashboard[bot] avatar Sep 09 '25 19:09 flutter-dashboard[bot]

but do we have stats for how long it usually takes to flushSemantics without cache (bench_material3_semantics

I don't think this would be too risky as this is a one time thing, and without this PR the delay will just be on the next frame instead of the current frame.

chunhtai avatar Nov 05 '25 20:11 chunhtai

Yeah 3ms (as indicated by the web benchmark) when the user turns a11y on doesn't sound too bad. But I'm curious if there's an issue for this / is there a way to experience the current a11y delay myself?

LongCatIsLooong avatar Nov 05 '25 22:11 LongCatIsLooong

If not now, the delay it would be on the next frame without this change. in terms of talkback reaction time, it is already bad when the talkback turns on, it usually take some seconds before it start polling for ANI.

My local testing is actually smoother with this change. My guess is a slight delay and return synchrnously is better than return empty ANI first and waiting for talkback's next polling

chunhtai avatar Nov 05 '25 22:11 chunhtai

@chunhtai Heads up that this has conflicts.

justinmc avatar Nov 18 '25 23:11 justinmc