fix(ui): clear text selection on tap anywhere in the article
Every block of the dictionary article was wrapped in its own SelectionContainer, so a tap in one block never cleared a highlight held in another. A single container now wraps the article list — a tap anywhere clears the selection and selection can span adjacent blocks.
This commit is contained in:
1 parent
4caf3a534d
commit
4e42a269a7
1 file changed
+13
-9
@@ -123,14 +123,11 @@ fun ArticleContent(
|
||||
val isHeavyArticle =
|
||||
articleState.dslContent.size > HEAVY_ARTICLE_BLOCK_COUNT
|
||||
|
||||
val articleList: @Composable (Modifier) -> Unit = { listModifier ->
|
||||
LazyColumn(
|
||||
state = listState,
|
||||
contentPadding = PaddingValues(top = Spacing.listItemVertical),
|
||||
modifier = modifier
|
||||
.fillMaxSize()
|
||||
.onSizeChanged { viewportSize = it }
|
||||
.windowInsetsPadding(AppWindowInsets.horizontalSafeDrawing)
|
||||
.padding(end = 16.dp)
|
||||
modifier = listModifier
|
||||
.testTag("article_content")
|
||||
.semantics {
|
||||
testTagsAsResourceId = true
|
||||
@@ -169,12 +166,19 @@ fun ArticleContent(
|
||||
)
|
||||
}
|
||||
}
|
||||
if (isHeavyArticle) {
|
||||
textContent()
|
||||
}
|
||||
}
|
||||
}
|
||||
val articleListModifier = modifier
|
||||
.fillMaxSize()
|
||||
.onSizeChanged { viewportSize = it }
|
||||
.windowInsetsPadding(AppWindowInsets.horizontalSafeDrawing)
|
||||
.padding(end = 16.dp)
|
||||
if (isHeavyArticle) {
|
||||
articleList(articleListModifier)
|
||||
} else {
|
||||
SelectionContainer { textContent() }
|
||||
}
|
||||
}
|
||||
SelectionContainer { articleList(articleListModifier) }
|
||||
}
|
||||
}
|
||||
is ArticleState.Error -> {
|
||||
|
||||
Reference in new issue
Block a user