[web] Don't add href="#" to semantics links (flutter/engine#53395)

This is a stopgap for issues like https://github.com/flutter/flutter/issues/146291 until we land better link semantics (in https://github.com/flutter/flutter/issues/150263 and https://github.com/flutter/packages/pull/6711). For the time being, the `href="#"` isn't providing any extra value, and is causing the browser to navigate to to `#` whenever the semantics link is clicked, which is undesirable.

Fixes https://github.com/flutter/flutter/issues/146291
This commit is contained in:
Mouad Debbar
2024-06-20 19:21:36 -04:00
committed by GitHub
parent 41deb96eb7
commit 33e1bcf96f
2 changed files with 3 additions and 3 deletions

View File

@@ -18,9 +18,8 @@ class Link extends PrimaryRoleManager {
@override
DomElement createElement() {
final DomElement element = domDocument.createElement('a');
// TODO(chunhtai): Fill in the real link once the framework sends entire uri.
// https://github.com/flutter/flutter/issues/102535.
element.setAttribute('href', '#');
// TODO(mdebbar): Fill in the real link once the framework sends entire uri.
// https://github.com/flutter/flutter/issues/150263.
element.style.display = 'block';
return element;
}

View File

@@ -3536,6 +3536,7 @@ void _testLink() {
final SemanticsObject object = pumpSemantics();
expect(object.element.tagName.toLowerCase(), 'a');
expect(object.element.hasAttribute('href'), isFalse);
});
}