Deprecate `SemanticsProperties.focusable` and `SemanticsConfiguration.isFocusable`
Summary
#
The SemanticsProperties.focusable and SemanticsConfiguration.isFocusable
parameters were deprecated in favor of the SemanticsProperties.focused
and
SemanticsConfiguration.isFocused parameters.
The focused parameter is now nullable.
Setting it to true or false automatically
sets isFocusable to true, while
setting it to null sets isFocusable to false.
Context
#
The SemanticsConfiguration.isFocusable property is a boolean that
indicates whether the semantics node can have input focus.
SemanticsConfiguration.isFocused is a boolean that indicates if the
semantics node has input focus.
This change also applies to
SemanticsProperties.focusable and SemanticsProperties.focused.
We deprecated isFocusable because its functionality is covered by isFocused.
The isFocused property is now stored as a tristate flag in the engine,
and this change makes the framework consistent with the engine.
Description of change
#
The SemanticsConfiguration.isFocusable property is
deprecated in favor of SemanticsConfiguration.isFocused.
This property is a nullable boolean; setting it to true or false
automatically sets isFocusable to true, and
setting it to null sets isFocusable to false.
Migration guide
#
Replace SemanticsConfiguration.isFocusable with
SemanticsConfiguration.isFocused.
Example 1: Setting isFocused to true automatically sets isFocusable
to true
#
Code before migration:
void describeSemanticsConfiguration(SemanticsConfiguration config) {
config.isFocusable = true;
config.isFocused = true;
}
Code after migration:
void describeSemanticsConfiguration(SemanticsConfiguration config) {
config.isFocused = true;
}
Example 2: Setting isFocused to null automatically sets isFocusable
to false
#
Code before migration:
void describeSemanticsConfiguration(SemanticsConfiguration config) {
config.isFocusable = false;
config.isFocused = false;
}
Code after migration:
void describeSemanticsConfiguration(SemanticsConfiguration config) {
config.isFocused = null;
}
Timeline
#
Landed in version: 3.37.0-0.0.pre
In stable release: 3.38
References
#API documentation:
Relevant issue:
Relevant PR:
Unless stated otherwise, the documentation on this site reflects Flutter 3.35.5. Page last updated on 2025-11-3. View source or report an issue.