Skip to content
40 changes: 40 additions & 0 deletions src/release/breaking-changes/editable-text-scroll-into-view.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
title: Updated EditableText scroll into view behavior
description: >
Improve EditableText selection scroll into view behavior to always
use the current selection extent.
---

## Summary

`Editable.onCaretChanged` callback is removed and with this change,
`EditableText` behavior with regard to scrolling the selection into view
changes.

## Context

To date, `EditableText` has used multiple mechanisms ensuring the selection
extent or caret is scrolled into view on updates.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you mean by "on updates".

Suggested change
To date, `EditableText` has used multiple mechanisms ensuring the selection
extent or caret is scrolled into view on updates.
Previously, `EditableText` used multiple mechanisms to determine the
extent of the selection, or to ensure that the caret is scrolled into view.

Copy link
Contributor Author

@tgucio tgucio Jun 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the edits. Yes, this is a bit convoluted: what I meant were the mechanisms used on scrolling into view (which happens on user updates) to determine either of:

  • selection extent (non-collapsed selection)
  • caret position (collapsed selection).

Let me reword as:

Previously, upon scrolling into view to show user updates, EditableText used multiple mechanisms to determine the extent of the selection or the caret location.


## Description of change

By removing the `Editable.onCaretChanged` callback, `EditableText` will always
use the most up to selection extent location when scrolling to show it.
Specifically this results in improved scroll into view behavior after
changing selection from collapsed to non-collapsed via
`userUpdateTextEditingValue()`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does "use the most up to selection extent location" mean?
I've made some tweaks, but would do more once I understand this phrase.

Suggested change
By removing the `Editable.onCaretChanged` callback, `EditableText` will always
use the most up to selection extent location when scrolling to show it.
Specifically this results in improved scroll into view behavior after
changing selection from collapsed to non-collapsed via
`userUpdateTextEditingValue()`.
By removing the `Editable.onCaretChanged` callback, `EditableText` will always
use the most up to selection extent location when scrolling to show it.
Specifically, this improves scroll into view behavior after
changing selection from collapsed to non-collapsed using
`userUpdateTextEditingValue()`.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The underlying issue had to do with using multiple sources of truth where one wasn't necessarily up to date (could be one frame behind).

What is clearly missing is "date" as in "up to date" :). Correcting this.


## Timeline

Landed in version: 3.12.0-4.0.pre<br>
In stable release: 3.13.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 3.13 release? It's probably best to just say "TBD" for now.


## References

API documentation:

* [`EditableText`]({{site.api}}/flutter/widgets/EditableText-class.html)

Relevant PRs:

* [109114: Remove Editable.onCaretChanged callback]({{site.repo.flutter}}/pull/109114)
2 changes: 2 additions & 0 deletions src/release/breaking-changes/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ release, and listed in alphabetical order:
* [Removed `ignoringSemantics`][] properties
* [Deprecated `RouteInformation.location`][] and its related APIs
* [Customize tabs alignment using the new `TabBar.tabAlignment` property][]
* [Updated EditableText scroll into view behavior][]

[Added AppLifecycleState.hidden]: {{site.url}}/release/breaking-changes/add-applifecyclestate-hidden
[Moved ReorderableListView's localized strings]: {{site.url}}/release/breaking-changes/material-localized-strings
[Removed `ignoringSemantics`]: {{site.url}}/release/breaking-changes/ignoringsemantics-migration
[Deprecated `RouteInformation.location`]: {{site.url}}/release/breaking-changes/route-information-uri
[Customize tabs alignment using the new `TabBar.tabAlignment` property]: {{site.url}}/release/breaking-changes/tab-alignment
[Updated EditableText scroll into view behavior]: {{site.url}}/release/breaking-changes/editable-text-scroll-into-view

### Released in Flutter 3.10

Expand Down