Many desktop apps don't show a focus ring around b...
# compose-desktop
a
Many desktop apps don't show a focus ring around buttons when you click them, but they still show it when doing tab navigation. How to implement that in Compose desktop? It seems there's no way to know the focus "source". When clicking there is a Focus event followed by a Press event shortly after so have to rely on timing checks to figure out if we were focused by a click...
Ah, I see there's a work item discusses the focus border when clicking buttons: https://youtrack.jetbrains.com/issue/CMP-5814/Review-Request-focus-on-click-feature The indication modifier on desktop has code to skip the Focus indication when it was focused by a tap - I will try using indication instead of the border modifier then https://github.com/JetBrains/compose-multiplatform-core/blob/d4d20c98119a980576b3f[…]src/commonMain/kotlin/androidx/compose/foundation/Indication.kt
c
> How to implement that in Compose desktop? It seems there’s no way to know the focus “source” It is possible, you just have to handle the focus state yourself. We’ve done this in Jewel: https://github.com/JetBrains/jewel/blob/main/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Button.kt#L131