-
Notifications
You must be signed in to change notification settings - Fork 6k
Add Semantics Property linkUrl
#53507
Conversation
| final int headingLevel; | ||
|
|
||
| /// See [ui.SemanticsUpdateBuilder.updateNode]. | ||
| final String? linkUri; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
linkUri is non-nullable in the updateNode API. Does it need to be nullable here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This mirrors the code for the nullable tooltip field. I think it is non-nullable in the updateNode API to make it easier for the C++ side to handle.
| // TODO(mdebbar): Fill in the real link once the framework sends entire uri. | ||
| // https://github.com/flutter/flutter/issues/150263. | ||
| element.style.display = 'block'; | ||
| if (semanticsObject.hasLinkUri) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the link change? If yes, this code should probably go into an override of the update method and it should also check for isLinkUriDirty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
lib/ui/fixtures/ui_test.dart
Outdated
| childrenInHitTestOrder: childrenInHitTestOrder, | ||
| additionalActions: additionalActions, | ||
| headingLevel: 0, | ||
| linkUri: '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think "URL" is more accurate here than "URI". The <a> tag and the Link widget only work with URIs that are also fetchable over the network via the same URI. Using arbitrary URIs as abstract identifiers without being able to fetch them is not something that's supported by this property, AFAICT. Unless there's something on the mobile side that extends beyond that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
linkUrilinkUrl
yjbanov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
auto label is removed for flutter/engine/53507, due to - The status or check suite Linux Web Framework tests has failed. Please fix the issues identified (or deflake) before re-applying this label. |

The new property allows the user to specify a URI for their semantics link node. It's plumbed through for both web and non-web engines, but it's only used in the web engine currently. It sets the
hrefof the anchor element associated with semantics node.This is going to unlock better semantics support in the Link widget on web (PR).
Framework counterpart: flutter/flutter#150639
Part of flutter/flutter#150263