-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Add breaking change doc for isFocusable #12159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
05fdc82
b817b98
abb85e4
3381f52
f6204cb
200dc75
3c59293
8c8fffe
fcd3bd5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
--- | ||
title: Deprecate `SemanticsProperties.focusable` and `SemanticsConfiguration.isFocusable` | ||
description: > | ||
The `focusable` parameter has been replaced by `isFocused`. | ||
--- | ||
|
||
## Summary | ||
|
||
The `SemanticsProperties.focusable` and `SemanticsConfiguration.isFocusable` | ||
parameters were deprecated in favor of the `SemanticsProperties.focused` and | ||
`SemanticsConfiguration.isFocused` parameters. | ||
|
||
## Context | ||
|
||
The `SemanticsConfiguration.isFocusable` is a boolean to describe | ||
whether the semantics node can have input focus, and | ||
`SemanticsConfiguration.isFocused` is a boolean to describe if the | ||
semantics node has input focus. | ||
|
||
The fix is the same with `SemanticsProperties.focusable` and `SemanticsProperties.focused`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This section should talk about why this we decide to deprecate isFocusable |
||
|
||
## Description of change | ||
|
||
The `SemanticsConfiguration.isFocusable` is deprecated in | ||
favor of `SemanticsConfiguration.isFocused`, which is a nullable boolean; | ||
setting it to true/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: | ||
|
||
```dart | ||
void describeSemanticsConfiguration(SemanticsConfiguration config) { | ||
config.isFocusable = true; | ||
config.isFocused = true; | ||
} | ||
``` | ||
|
||
Code after migration: | ||
|
||
```dart | ||
void describeSemanticsConfiguration(SemanticsConfiguration config) { | ||
config.isFocused = true; | ||
} | ||
``` | ||
|
||
### Example 2: setting `isFocused` to null automatically sets `isFocusable` to `false`. | ||
|
||
Code before migration: | ||
|
||
```dart | ||
void describeSemanticsConfiguration(SemanticsConfiguration config) { | ||
config.isFocusable = false; | ||
config.isFocused = false; | ||
} | ||
``` | ||
|
||
Code after migration: | ||
|
||
```dart | ||
void describeSemanticsConfiguration(SemanticsConfiguration config) { | ||
config.isFocused = null; | ||
} | ||
``` | ||
|
||
|
||
## Timeline | ||
|
||
Landed in version: Not yet<br> | ||
In stable release: Not yet | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this in the main channel yet? If so, when did it land? Please add that info here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the PR is still pending review, will add the info after the PR is landed |
||
|
||
## References | ||
|
||
API documentation: | ||
|
||
* [`SemanticsConfiguration`][] | ||
* [`SemanticsProperties`][] | ||
* [`SemanticsNode`][] | ||
|
||
Relevant issue: | ||
|
||
* [Issue 166092][] | ||
|
||
Relevant PR: | ||
|
||
* [PR 170935][] | ||
|
||
[`SemanticsConfiguration`]: {{site.api}}/flutter/semantics/SemanticsConfiguration-class.html | ||
[`SemanticsProperties`]: {{site.api}}/flutter/semantics/SemanticsProperties-class.html | ||
[`SemanticsNode`]: {{site.api}}/flutter/semantics/SemanticsNode-class.html | ||
[Issue 166101]: {{site.repo.flutter}}/issues/166101 | ||
[PR 168703]: {{site.repo.flutter}}/pull/170935 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
somwhere here should probably mention focused become nullable