-
Notifications
You must be signed in to change notification settings - Fork 237
Add snippets for focus management in Compose #560
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a set of Compose snippets demonstrating focus management use-cases and wires them into the existing snippets navigation.
- Adds new focus snippets covering request focus, focus movement, focus state, focus traversal, and focus targets.
- Extends the navigation graph (
Destination.kt
andSnippetsActivity.kt
) to include a new FocusExamples screen and its sub-routes. - Refactors visibility and imports in
FocusSnippets.kt
to expose snippet functions and update snippet identifiers.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
File | Description |
---|---|
touchinput/focus/RequestFocus.kt |
New snippet for requesting focus and redirection |
touchinput/focus/MoveFocus.kt |
New snippet for advancing and clearing focus with ESC |
touchinput/focus/FocusedState.kt |
New snippet for applying ripples based on focus state |
touchinput/focus/FocusTraversal.kt |
New 1D/2D focus traversal examples and overrides |
touchinput/focus/FocusTarget.kt |
New snippet showing which UI elements are focus targets |
touchinput/focus/FocusSnippets.kt |
Hosts all focus snippet UIs, updated visibilities and imports |
navigation/Destination.kt |
Added FocusExamples enum and entries |
SnippetsActivity.kt |
Registered the new FocusExamples routes |
Comments suppressed due to low confidence (1)
compose/snippets/src/main/java/com/example/compose/snippets/touchinput/focus/FocusTarget.kt:122
- This snippet ID is duplicated in
InteractiveUiElementIsFocusTargets
; consider giving each snippet a unique tag to avoid collisions in generated docs.
// [START android_compose_touchinput_focus_target_interactive_ui_element]
This pull request add some snippets about focus management