material-components / material-components/material-components-android

[BotttomSheetDialog] Text Selection Thumbs offset when placed inside of BottomSheetDialogFragment

Open
#4,895 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Widget: BottomSheet
Dominant language
Java
Stars
17.4k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

**Description:** When selecting text inside of a `BottomSheetDialogFragment` the thumbs are not attached to the actual selection and jump to the top of the screen and are displayed outside of the actual bottom sheet.

https://github.com/user-attachments/assets/3906e7ce-61d9-47e0-aa46-684e3b9a1dbe

**Expected behavior:** The thumbs should be attached to the text selection and not float at the top of the screen.

**Source code:**

```kotlin
class BottomSheetFragment() : BottomSheetDialogFragment() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
return ComposeView(requireContext()).apply {
setContent {
Scaffold(
topBar = {
Text("Bottom Sheet")
}
) { padding ->
Column(Modifier.padding(padding).padding(16.dp)) {
TextField(
"Test",
onValueChange = { },
label = { Text("Label") }
)
}
}
}
}
}
}
```

**Minimal sample app repro:** [BottomSheetSelectionRepro.zip](https://github.com/user-attachments/files/21735747/BottomSheetSelectionRepro.zip)

**Android API version:** 36

**Material Library version:** 1.13.0-rc01

**Device:** Google Pixel 7

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked BottomSheetSelectionRepro.zip and the BottomSheetFragment source shown in the issue. Run the sample on the stated Pixel 7/API 36 setup with Material Library 1.13.0-rc01, then inspect the BottomSheetDialogFragment and ComposeView integration while reproducing text selection. Done means the selection thumbs remain attached to the selected text inside the bottom sheet.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.