-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Focus the first item at the start #4917
Comments
Welcome change, but it is a breaking one... |
This happened in Jetpack Compose 1.7 with TextField as well (checked a screen with one TextField on 1.6 and 1.7) |
After JetBrains/compose-multiplatform-core#1352, it already works for |
Right, but there one could think of it as making |
No need to apply them anymore. ``` git diff androidx/compose-ui/1.6.7 origin/jb-main -- compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusOwnerImpl.kt > 1.patch ``` Fixes https://youtrack.jetbrains.com/issue/COMPOSE-1212/Integration.-Check-changes-in-FocusOwnerImpl JetBrains/compose-multiplatform#4917 Make the first ComposeComponent focused initially Apply jb-main FocusOwnerImpl.kt changes No need to apply them anymore. ``` git diff androidx/compose-ui/1.6.7 origin/jb-main -- compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusOwnerImpl.kt > 1.patch ``` Fixes https://youtrack.jetbrains.com/issue/COMPOSE-1212/Integration.-Check-changes-in-FocusOwnerImpl Fixes JetBrains/compose-multiplatform#4919 JetBrains/compose-multiplatform#4917 JetBrains/compose-multiplatform#2944
Seems like it happens only when we use physical keyboard. Probably it wasn't intentional |
+1 on this, just ran into this and was about to report as a bug. Discovered when |
I just ran into this again, and it's become somewhat high priority (for me) to find a fix or workaround. It appears, in my testing, that it's impossible to receive keyboard events reliably in Compose Desktop, because if I might be missing something, but if true, this is a huge issue. I just want |
Your issue is solvable using #4764 (comment) (answered in Slack) This enhancement won't solve it, as if there is no focusable elements, there will be no focus. |
Agreed. The challenge with hooking in to this at the Window level is implementing hotkeys adds tight coupling between window code and the screen-level code, which I try and keep separate. It's also arguably an unexpected behaviour, which means it'll be a source of bugs. I know it was for me. This is mentioned in the second bullet point in #4764, but just echoing here to give it a +1 |
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks. |
When we:
focusManager.clearFocus
we should focus the first focusable node, otherwise remove the focus completely (the root node focusState = Inactive). In Compose 1.6.10 we always focus the root node on non-Android platforms.
A relevant change in Jetpack Compose was in https://android-review.googlesource.com/c/platform/frameworks/support/+/2813125
The text was updated successfully, but these errors were encountered: