shouldSkipNode method

bool shouldSkipNode(
  1. SemanticsNode node
)

Returns whether SemanticsNode should be skipped for minimum tap target guideline.

Skips nodes which are link, hidden, or do not have actions.

Implementation

bool shouldSkipNode(SemanticsNode node) {
  final SemanticsData data = node.getSemanticsData();
  // Skip node if it has no actions, or is marked as hidden.
  if ((!data.hasAction(ui.SemanticsAction.longPress) &&
          !data.hasAction(ui.SemanticsAction.tap)) ||
      data.hasFlag(ui.SemanticsFlag.isHidden)) {
    return true;
  }
  // Skip links https://www.w3.org/WAI/WCAG21/Understanding/target-size.html
  if (data.hasFlag(ui.SemanticsFlag.isLink)) {
    return true;
  }
  return false;
}