Skip to content
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

V2 BottomSheet Focus Accessibility: Auto Expansion for content focus in sliderOver #635

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.focus.onFocusChanged
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shape
Expand Down Expand Up @@ -456,7 +457,12 @@ fun BottomSheet(
}
Column(modifier = Modifier
.testTag(BOTTOMSHEET_CONTENT_TAG)
.then(if (slideOver) Modifier else Modifier.fillMaxSize()),
.then(if (slideOver) Modifier
Anubhvv marked this conversation as resolved.
Show resolved Hide resolved
.onFocusChanged { focusState ->
if (focusState.hasFocus && sheetState.currentValue != BottomSheetValue.Expanded) { // this expands the sheet when the content is focused
scope.launch { sheetState.expand() }
}
} else Modifier.fillMaxSize()),
content = { sheetContent() })
}
}
Expand Down