[a11y] Add long click label
This commit is contained in:
parent
ef8d57dff8
commit
5d81a0264b
12 changed files with 66 additions and 15 deletions
|
|
@ -173,6 +173,7 @@ private fun RoomSummaryScaffoldRow(
|
|||
val clickModifier = Modifier.combinedClickable(
|
||||
onClick = { onClick(room) },
|
||||
onLongClick = { onLongClick(room) },
|
||||
onLongClickLabel = stringResource(CommonStrings.action_open_context_menu),
|
||||
indication = ripple(),
|
||||
interactionSource = remember { MutableInteractionSource() }
|
||||
)
|
||||
|
|
|
|||
|
|
@ -17,10 +17,12 @@ import androidx.compose.runtime.remember
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.theme.components.Surface
|
||||
import io.element.android.libraries.ui.strings.CommonStrings
|
||||
|
||||
private val CORNER_RADIUS = 8.dp
|
||||
|
||||
|
|
@ -41,6 +43,7 @@ fun MessageStateEventContainer(
|
|||
.combinedClickable(
|
||||
onClick = onClick,
|
||||
onLongClick = onLongClick,
|
||||
onLongClickLabel = stringResource(CommonStrings.action_open_context_menu),
|
||||
indication = ripple(),
|
||||
interactionSource = interactionSource
|
||||
),
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ import io.element.android.libraries.designsystem.theme.components.Surface
|
|||
import io.element.android.libraries.designsystem.theme.components.Text
|
||||
import io.element.android.libraries.matrix.api.media.MediaSource
|
||||
import io.element.android.libraries.matrix.ui.media.MediaRequestData
|
||||
import io.element.android.libraries.ui.strings.CommonStrings
|
||||
|
||||
@Composable
|
||||
@Suppress("ModifierClickableOrder") // This is needed to display the right ripple shape
|
||||
|
|
@ -103,6 +104,7 @@ fun MessagesReactionButton(
|
|||
userAlreadyReacted = content.isHighlighted
|
||||
)
|
||||
},
|
||||
onLongClickLabel = stringResource(CommonStrings.action_open_context_menu),
|
||||
onLongClick = onLongClick
|
||||
)
|
||||
// Inner border, to highlight when selected
|
||||
|
|
|
|||
|
|
@ -51,7 +51,12 @@ internal fun TimelineItemCallNotifyView(
|
|||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.border(1.dp, ElementTheme.colors.borderInteractiveSecondary, RoundedCornerShape(8.dp))
|
||||
.combinedClickable(enabled = true, onClick = {}, onLongClick = { onLongClick(event) })
|
||||
.combinedClickable(
|
||||
enabled = true,
|
||||
onClick = {},
|
||||
onLongClick = { onLongClick(event) },
|
||||
onLongClickLabel = stringResource(CommonStrings.action_open_context_menu),
|
||||
)
|
||||
.padding(12.dp),
|
||||
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
|
|
|
|||
|
|
@ -145,14 +145,15 @@ internal fun TimelineItemRow(
|
|||
// Custom clickable that applies over the whole item for accessibility
|
||||
.then(
|
||||
if (isTalkbackActive()) {
|
||||
Modifier.combinedClickable(
|
||||
onClick = { onContentClick(timelineItem) },
|
||||
onLongClick = { onLongClick(timelineItem) }
|
||||
)
|
||||
} else {
|
||||
Modifier
|
||||
}
|
||||
),
|
||||
Modifier.combinedClickable(
|
||||
onClick = { onContentClick(timelineItem) },
|
||||
onLongClick = { onLongClick(timelineItem) },
|
||||
onLongClickLabel = stringResource(CommonStrings.action_open_context_menu),
|
||||
)
|
||||
} else {
|
||||
Modifier
|
||||
}
|
||||
),
|
||||
event = timelineItem,
|
||||
timelineRoomInfo = timelineRoomInfo,
|
||||
renderReadReceipts = renderReadReceipts,
|
||||
|
|
|
|||
|
|
@ -66,7 +66,17 @@ fun TimelineItemStickerView(
|
|||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.then(if (isLoaded) Modifier.background(Color.White) else Modifier)
|
||||
.then(if (onContentClick != null) Modifier.combinedClickable(onClick = onContentClick, onLongClick = onLongClick) else Modifier),
|
||||
.then(
|
||||
if (onContentClick != null) {
|
||||
Modifier
|
||||
.combinedClickable(
|
||||
onClick = onContentClick,
|
||||
onLongClick = onLongClick,
|
||||
onLongClickLabel = stringResource(CommonStrings.action_open_context_menu), )
|
||||
} else {
|
||||
Modifier
|
||||
}
|
||||
),
|
||||
model = MediaRequestData(
|
||||
source = content.preferredMediaSource,
|
||||
kind = MediaRequestData.Kind.File(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue