SemanticsHitTestBehavior enum
Describes how a semantic node should behave during hit testing.
This enum allows the framework to communicate pointer event handling behavior to the platform's accessibility layer. Different platforms may implement this behavior differently based on their accessibility infrastructure.
See also:
- SemanticsUpdateBuilder.updateNode, which accepts this enum.
Values
- defer → const SemanticsHitTestBehavior
-
Defer to the platform's default hit test behavior inference.
When set to defer, the platform will infer the appropriate behavior based on the semantic node's properties such as interactive behaviors, route scoping, etc.
On the web, the default inferred behavior is
transparentfor non-interactive semantic nodes, allowing pointer events to pass through.This is the default value and provides backward compatibility.
- opaque → const SemanticsHitTestBehavior
-
The semantic element is opaque to hit testing, consuming any pointer events within its bounds and preventing them from reaching elements behind it in Z-order (siblings and ancestors).
Children of this node can still receive pointer events normally. Only elements that are visually behind this node (lower in the stacking order) will be blocked from receiving events.
This is typically used for modal surfaces like dialogs, bottom sheets, and drawers that should block interaction with content behind them while still allowing interaction with their own content.
Platform implementations:
- On the web, this results in
pointer-events: allCSS property.
- On the web, this results in
- transparent → const SemanticsHitTestBehavior
-
The semantic element is transparent to hit testing.
Transparent nodes do not receive hit test events and allow events to pass through to elements behind them.
Note: This differs from the framework's
HitTestBehavior.translucent, which receives events while also allowing pass-through. Web's binarypointer-eventsproperty (all or none) cannot support true translucent behavior.Platform implementations:
- On the web, this results in
pointer-events: noneCSS property.
- On the web, this results in
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
values
→ const List<
SemanticsHitTestBehavior> - A constant List of the values in this enum, in order of their declaration.