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:
OneWay authored and Evgenii committed 2026-09-21 13:25:41 +08:00
1 parent 4caf3a534d
commit 4e42a269a7
1 file changed
+13 -9
@@ -123,14 +123,11 @@ fun ArticleContent(
val isHeavyArticle = val isHeavyArticle =
articleState.dslContent.size > HEAVY_ARTICLE_BLOCK_COUNT articleState.dslContent.size > HEAVY_ARTICLE_BLOCK_COUNT
val articleList: @Composable (Modifier) -> Unit = { listModifier ->
LazyColumn( LazyColumn(
state = listState, state = listState,
contentPadding = PaddingValues(top = Spacing.listItemVertical), contentPadding = PaddingValues(top = Spacing.listItemVertical),
modifier = modifier modifier = listModifier
.fillMaxSize()
.onSizeChanged { viewportSize = it }
.windowInsetsPadding(AppWindowInsets.horizontalSafeDrawing)
.padding(end = 16.dp)
.testTag("article_content") .testTag("article_content")
.semantics { .semantics {
testTagsAsResourceId = true testTagsAsResourceId = true
@@ -169,12 +166,19 @@ fun ArticleContent(
) )
} }
} }
if (isHeavyArticle) {
textContent() textContent()
}
}
}
val articleListModifier = modifier
.fillMaxSize()
.onSizeChanged { viewportSize = it }
.windowInsetsPadding(AppWindowInsets.horizontalSafeDrawing)
.padding(end = 16.dp)
if (isHeavyArticle) {
articleList(articleListModifier)
} else { } else {
SelectionContainer { textContent() } SelectionContainer { articleList(articleListModifier) }
}
}
} }
} }
is ArticleState.Error -> { is ArticleState.Error -> {