engine
engine copied to clipboard
[Web][A11y] Fix link onClick behavior on links
Right now, when semantics are enabled in flutter web, anchor tags are created around anything that is Semantics(link: true). These anchor tags have an href="#". Right now, when these anchor tags are clicked, they actually navigate the page to /#, and then the underlying flutter onTap is also triggered. We don't want the anchor tag to actually trigger a redirect, since the onTap is handled by the framework. We can avoid this by calling preventDefault() on the anchor tag's click events.
Internal bug: b/321779318
Pre-launch Checklist
- [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
- [x] I read the Tree Hygiene wiki page, which explains my responsibilities.
- [x] I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
- [x] I listed at least one issue that this PR fixes in the description above.
- [x] I added new tests to check the change I am making or feature I am adding, or the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
- [x] I updated/added relevant documentation (doc comments with
///). - [x] I signed the CLA.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel on Discord.
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).
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.
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.
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).
If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.
Changes reported for pull request #49984 at sha ce9d21ad71aba4496e23efecac4d2b748a54d280
Sorry for the late reply here, I didn't know about this PR.
I've been working on fixing multiple issues in links (Link PR and engine PR). Both PRs are still WIP. The issue you are addressing here should also be fixed by the PRs once they are complete.
@mdebbar what's the latest? is this PR still relevant?