[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:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -3536,6 +3536,7 @@ void _testLink() {
|
||||
|
||||
final SemanticsObject object = pumpSemantics();
|
||||
expect(object.element.tagName.toLowerCase(), 'a');
|
||||
expect(object.element.hasAttribute('href'), isFalse);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user