Skip to content

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
98 changes: 98 additions & 0 deletions src/content/release/breaking-changes/deprecate-focusable.md
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
Copy link
Contributor

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

`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`.
Copy link
Contributor

Choose a reason for hiding this comment

The 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

Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Member Author

Choose a reason for hiding this comment

The 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
2 changes: 2 additions & 0 deletions src/content/release/breaking-changes/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@ They're sorted by release and listed in alphabetical order:
* [Stop generating `AssetManifest.json`][]
* [UISceneDelegate adoption][]
* [Component theme normalization updates][]
* [Deprecate `SemanticsProperties.focusable` and `SemanticsConfiguration.isFocusable`][]

[Redesigned the Radio Widget]: /release/breaking-changes/radio-api-redesign
[Removed semantics elevation and thickness]: /release/breaking-changes/remove-semantics-elevation-and-thickness
[Deprecate `TextField.canRequestFocus`]: /release/breaking-changes/can-request-focus
[Stop generating `AssetManifest.json`]: /release/breaking-changes/asset-manifest-dot-json
[UISceneDelegate adoption]: /release/breaking-changes/uiscenedelegate
[Component theme normalization updates]: /release/breaking-changes/component-theme-normalization-updates
[Deprecate `SemanticsProperties.focusable` and `SemanticsConfiguration.isFocusable`]: /release/breaking-changes/deprecate-focusable

<a id="released-in-flutter-332" aria-hidden="true"></a>
### Released in Flutter 3.32
Expand Down