Repository navigation
fix: keep search focused while navigating the menu #1209
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: v1
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ import androidx.compose.foundation.background | |
| import androidx.compose.foundation.border | ||
| import androidx.compose.foundation.gestures.awaitEachGesture | ||
| import androidx.compose.foundation.gestures.awaitFirstDown | ||
| import androidx.compose.foundation.gestures.waitForUpOrCancellation | ||
| import androidx.compose.foundation.interaction.InteractionSource | ||
| import androidx.compose.foundation.interaction.collectIsHoveredAsState | ||
| import androidx.compose.foundation.layout.Arrangement | ||
|
|
@@ -41,7 +42,6 @@ import androidx.compose.ui.draw.clip | |
| import androidx.compose.ui.draw.clipToBounds | ||
| import androidx.compose.ui.draw.drawWithCache | ||
| import androidx.compose.ui.draw.rotate | ||
| import androidx.compose.ui.focus.focusProperties | ||
| import androidx.compose.ui.geometry.Offset | ||
| import androidx.compose.ui.geometry.Size | ||
| import androidx.compose.ui.geometry.center | ||
|
|
@@ -248,11 +248,11 @@ fun ColumnScope.ModsGrid(category: ModCategory) { | |
| .weight(1f) | ||
| // see overlayActive above: the overlay card has to be able to leave the grid while it exists | ||
| .then(if (overlayActive) Modifier else Modifier.clipToBounds()) | ||
| // cards can't take focus, so clear it on press to unfocus the search field | ||
| // cards and their buttons consume their clicks, so only a click on empty space unfocuses the search field | ||
| .pointerInput(focusManager) { | ||
| awaitEachGesture { | ||
| awaitFirstDown(requireUnconsumed = false, pass = PointerEventPass.Initial) | ||
| focusManager.clearFocus() | ||
| awaitFirstDown(requireUnconsumed = false, pass = PointerEventPass.Final) | ||
| if (waitForUpOrCancellation(PointerEventPass.Final) != null) focusManager.clearFocus() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 [P2] Wait for release on the Main pointer-event pass
|
||
| } | ||
| } | ||
| .reorderContainer(reorderState), | ||
|
|
@@ -468,7 +468,6 @@ fun ModCard( | |
| if (interactive) { | ||
| // cards never take focus, otherwise they slide in from off screen when scrolled back into view | ||
| Modifier | ||
| .focusProperties { canFocus = false } | ||
| .onClick(interactionSource) { openModCard(mod) } | ||
| .pointerHoverIcon(PointerIcon.Hand) | ||
| } else { | ||
|
|
@@ -507,7 +506,6 @@ fun ModCard( | |
| .then( | ||
| if (toggle != null && interactive) { | ||
| Modifier | ||
| .focusProperties { canFocus = false } | ||
| .onClick(footerInteractions) { | ||
| if (!enabled && toggle.needsSetup()) { | ||
| open() | ||
|
|
@@ -653,7 +651,6 @@ private fun FavoriteStar( | |
| .then( | ||
| if (interactive) { | ||
| Modifier | ||
| .focusProperties { canFocus = false } | ||
| .onClick(interactionSource) { ModFavorites.toggle(mod.id) } | ||
| .pointerHoverIcon(PointerIcon.Hand) | ||
| } else { | ||
|
|
||
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.
🟡 [P2] Preserve the clicked entry across chain normalization