Skip to content

Conversation

@justinmc
Copy link
Contributor

@justinmc justinmc commented Jan 6, 2022

This PR simply adds some docs about TextEditingValue's default selection, which is collapsed at index -1. This selection value of -1 is a constant source of problems in Flutter, but if we can't eliminate it for now, we need to clearly document what it is.

Partial fix for #95978

@justinmc justinmc self-assigned this Jan 6, 2022
@flutter-dashboard flutter-dashboard bot added a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. labels Jan 6, 2022
@justinmc justinmc merged commit 44849ab into flutter:master Jan 10, 2022
@justinmc justinmc deleted the selection-default-docs branch January 10, 2022 18:06
auto-submit bot pushed a commit that referenced this pull request Feb 14, 2024
…143452)

## Description

This PR adds more documentation for `TextEditingController(String text)` constructor and it adds one example.

#96245 was a first improvement to the documentation.
#79495 tried to hide the cursor when an invalid selection is set but it was reverted.
#123777 mitigated the issue of having a default invalid selection: it takes care of setting a proper selection when a text field is focused and its controller selection is not initialized.

I will try changing the initial selection in another PR, but It will probably break several existing tests.

## Related Issue

Fixes #95978

## Tests

Adds 1 test for the new example.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants