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, and
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: Not yet
References
#API documentation:
Relevant issue:
Relevant PR:
Unless stated otherwise, the documentation on this site reflects the latest stable version of Flutter. Page last updated on 2025-09-25. View source or report an issue.