isSemanticLocatorCandidate function
True for the element that owns user-facing semantics, excluding the many implementation descendants that resolve to the same merged semantics node.
Implementation
bool isSemanticLocatorCandidate(Element element) {
final widget = element.widget;
if (_isGenericTapTarget(widget) && _hasSpecificControlAncestor(element)) {
return false;
}
if (widget is Semantics || isActionableControl(element)) return true;
// Non-tappable feedback / settings panels used as `within` scopes.
return isCardScopeHost(element);
}