You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a typical text field, selecting all of the text and pressing the delete key causes all of the text to be deleted.
However, if the text field is set to disapear if the text is empty then this will not work. The TextField flickers. For a brief moment it looks like the text is deleted but it comes right back.
Note that deleting all of the text one deleting one character at a time works fine with the same code.
Affected platforms
Desktop (macOS)
Versions
Libraries:
Compose Multiplatform version: 1.7.0-dev1686
Kotlin version: 2.0.0-RC1
OS version: MacOS 14.5
OS architecture: arm64
JDK: 20
To Reproduce
Steps to reproduce the behavior:
Run this code snippet:
importandroidx.compose.material3.TextFieldimportandroidx.compose.runtime.mutableStateOfimportandroidx.compose.ui.window.Windowimportandroidx.compose.ui.window.applicationfunmain() {
val text = mutableStateOf("1. Select all of me\n2. Delete")
application {
Window(
onCloseRequest = ::exitApplication
) {
val textValue = text.value
if (textValue.isNotEmpty()) {
TextField(
value = textValue,
onValueChange = {
text.value = it
}
)
}
}
}
}
Click on the text
Use the Command-A keyboard shortcut to select all of the text
Press the Delete keyboard button
Observe the textfield flicker, but otherwise the text does not get deleted
Expected behavior
The text should be deleted, and the text field should disapear.
If you delete one character at a time, this behavior can be observed.
Additional context
The reason that my app has a text field like this is because some items can have optional text metadata. It makes sense in my UI because there is a separate way to "add" a text area with template text, but when all of the text gets deleted that is equivalent to the entire text element being deleted.
The text was updated successfully, but these errors were encountered:
Describe the bug
In a typical text field, selecting all of the text and pressing the delete key causes all of the text to be deleted.
However, if the text field is set to disapear if the text is empty then this will not work. The TextField flickers. For a brief moment it looks like the text is deleted but it comes right back.
Note that deleting all of the text one deleting one character at a time works fine with the same code.
Affected platforms
Versions
Libraries:
Kotlin version: 2.0.0-RC1
OS version: MacOS 14.5
OS architecture: arm64
JDK: 20
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The text should be deleted, and the text field should disapear.
If you delete one character at a time, this behavior can be observed.
Additional context
The reason that my app has a text field like this is because some items can have optional text metadata. It makes sense in my UI because there is a separate way to "add" a text area with template text, but when all of the text gets deleted that is equivalent to the entire text element being deleted.
The text was updated successfully, but these errors were encountered: