Skip to content

Commit

Permalink
enhancement: improve accessibility • part 1 (#217)
Browse files Browse the repository at this point in the history
* update l10n

* add content descriptions to graphic elements without textual counterpart
  • Loading branch information
AkesiSeli authored Jan 3, 2025
1 parent c0fe2f7 commit 12b5a79
Show file tree
Hide file tree
Showing 87 changed files with 588 additions and 256 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ fun FeedbackButton(
imageVector: ImageVector,
modifier: Modifier = Modifier,
enabled: Boolean = true,
contentDescription: String?,
tintColor: Color = MaterialTheme.colorScheme.background.copy(alpha = ancillaryTextAlpha),
onClick: () -> Unit,
) {
Expand Down Expand Up @@ -54,7 +55,7 @@ fun FeedbackButton(
},
),
imageVector = imageVector,
contentDescription = null,
contentDescription = contentDescription,
tint = tintColor,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import com.livefast.eattrash.raccoonforlemmy.core.appearance.di.getColorSchemePr
import com.livefast.eattrash.raccoonforlemmy.core.appearance.di.getThemeRepository
import com.livefast.eattrash.raccoonforlemmy.core.appearance.theme.CornerSize
import com.livefast.eattrash.raccoonforlemmy.core.appearance.theme.Spacing
import com.livefast.eattrash.raccoonforlemmy.core.l10n.LocalStrings
import com.livefast.eattrash.raccoonforlemmy.core.utils.compose.onClick

data class FloatingActionButtonMenuItem(
Expand Down Expand Up @@ -179,7 +180,7 @@ fun FloatingActionButtonMenu(
Icon(
modifier = Modifier.rotate(fabRotation),
imageVector = Icons.Default.Add,
contentDescription = null,
contentDescription = LocalStrings.current.actionOpenActionMenu,
tint = MaterialTheme.colorScheme.onPrimaryContainer,
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import androidx.compose.ui.unit.toSize
import com.livefast.eattrash.raccoonforlemmy.core.appearance.theme.IconSize
import com.livefast.eattrash.raccoonforlemmy.core.appearance.theme.Spacing
import com.livefast.eattrash.raccoonforlemmy.core.appearance.theme.ancillaryTextAlpha
import com.livefast.eattrash.raccoonforlemmy.core.l10n.LocalStrings
import com.livefast.eattrash.raccoonforlemmy.core.utils.toLocalDp

@Composable
Expand Down Expand Up @@ -124,7 +125,7 @@ fun SearchField(
) {
Icon(
imageVector = Icons.Default.Clear,
contentDescription = null,
contentDescription = LocalStrings.current.actionClear,
tint = MaterialTheme.colorScheme.onBackground,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import com.livefast.eattrash.raccoonforlemmy.core.appearance.theme.readContentAl
import com.livefast.eattrash.raccoonforlemmy.core.commonui.components.CustomImage
import com.livefast.eattrash.raccoonforlemmy.core.commonui.components.CustomizedContent
import com.livefast.eattrash.raccoonforlemmy.core.commonui.components.PlaceholderImage
import com.livefast.eattrash.raccoonforlemmy.core.l10n.LocalStrings
import com.livefast.eattrash.raccoonforlemmy.core.utils.compose.onClick
import com.livefast.eattrash.raccoonforlemmy.domain.lemmy.data.CommunityModel
import com.livefast.eattrash.raccoonforlemmy.domain.lemmy.data.UserModel
Expand Down Expand Up @@ -270,34 +271,34 @@ fun CommunityAndCreatorInfo(
Icon(
modifier = buttonModifier,
imageVector = Icons.Default.LocalPolice,
contentDescription = null,
contentDescription = LocalStrings.current.itemFromModerator,
)
}
if (distinguished) {
Icon(
modifier = buttonModifier,
imageVector = Icons.Default.WorkspacePremium,
contentDescription = null,
contentDescription = LocalStrings.current.itemDistinguished,
)
} else if (featuredLocal) {
Icon(
modifier = buttonModifier,
imageVector = Icons.Default.Verified,
contentDescription = null,
contentDescription = LocalStrings.current.itemFeaturedInstance,
)
} else if (featuredCommunity) {
Icon(
modifier = buttonModifier,
imageVector = Icons.Default.Stars,
contentDescription = null,
contentDescription = LocalStrings.current.itemFeaturedCommunity,
)
}

if (locked) {
Icon(
modifier = buttonModifier,
imageVector = Icons.Default.Lock,
contentDescription = null,
contentDescription = LocalStrings.current.itemFeaturedInstance,
)
}
if (indicatorExpanded != null) {
Expand All @@ -309,12 +310,12 @@ fun CommunityAndCreatorInfo(
if (indicatorExpanded) {
Icon(
imageVector = Icons.Default.ExpandLess,
contentDescription = null,
contentDescription = LocalStrings.current.actionCollapse,
)
} else {
Icon(
imageVector = Icons.Default.ExpandMore,
contentDescription = null,
contentDescription = LocalStrings.current.actionExpand,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ fun CommunityHeader(
Icon(
modifier = Modifier.size(iconSize),
imageVector = Icons.Default.Group,
contentDescription = null,
contentDescription = LocalStrings.current.communityInfoSubscribers,
)
Text(
text =
Expand All @@ -164,7 +164,7 @@ fun CommunityHeader(
Icon(
modifier = Modifier.size(iconSize),
imageVector = Icons.Default.CalendarViewMonth,
contentDescription = null,
contentDescription = LocalStrings.current.communityInfoMonthlyActiveUsers,
)
Text(
text =
Expand All @@ -188,7 +188,7 @@ fun CommunityHeader(
) {
Icon(
imageVector = Icons.Default.Info,
contentDescription = null,
contentDescription = LocalStrings.current.moreInfo,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import com.livefast.eattrash.raccoonforlemmy.core.appearance.theme.ancillaryText
import com.livefast.eattrash.raccoonforlemmy.core.commonui.components.CustomDropDown
import com.livefast.eattrash.raccoonforlemmy.core.commonui.components.CustomImage
import com.livefast.eattrash.raccoonforlemmy.core.commonui.components.PlaceholderImage
import com.livefast.eattrash.raccoonforlemmy.core.l10n.LocalStrings
import com.livefast.eattrash.raccoonforlemmy.core.utils.compose.buildAnnotatedStringWithHighlights
import com.livefast.eattrash.raccoonforlemmy.core.utils.toLocalDp
import com.livefast.eattrash.raccoonforlemmy.domain.lemmy.data.CommunityModel
Expand Down Expand Up @@ -206,7 +207,7 @@ fun CommunityItem(
) {
Icon(
imageVector = Icons.Default.MoreVert,
contentDescription = null,
contentDescription = LocalStrings.current.actionOpenOptionMenu,
tint = ancillaryColor,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ fun DetailInfoItem(
verticalAlignment = Alignment.CenterVertically,
) {
if (icon != null) {
Icon(imageVector = icon, contentDescription = null)
Icon(
imageVector = icon,
contentDescription = null,
)
}
Text(
text =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ fun InboxCardHeader(
.padding(end = Spacing.s)
.size(IconSize.xs),
imageVector = Icons.Filled.FiberManualRecord,
contentDescription = null,
contentDescription = LocalStrings.current.itemUnread,
tint = ancillaryColor,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import com.livefast.eattrash.raccoonforlemmy.core.commonui.components.CustomDrop
import com.livefast.eattrash.raccoonforlemmy.core.commonui.components.CustomImage
import com.livefast.eattrash.raccoonforlemmy.core.commonui.components.CustomizedContent
import com.livefast.eattrash.raccoonforlemmy.core.commonui.components.FeedbackButton
import com.livefast.eattrash.raccoonforlemmy.core.l10n.LocalStrings
import com.livefast.eattrash.raccoonforlemmy.core.utils.VoteAction
import com.livefast.eattrash.raccoonforlemmy.core.utils.compose.onClick
import com.livefast.eattrash.raccoonforlemmy.core.utils.datetime.prettifyDate
Expand Down Expand Up @@ -206,7 +207,7 @@ fun InboxReplySubtitle(
) {
Icon(
imageVector = Icons.AutoMirrored.Default.Chat,
contentDescription = null,
contentDescription = LocalStrings.current.actionReply,
tint = ancillaryColor,
)
}
Expand All @@ -216,7 +217,7 @@ fun InboxReplySubtitle(
Icon(
modifier = Modifier.size(IconSize.m).padding(1.5.dp),
imageVector = Icons.Default.Schedule,
contentDescription = null,
contentDescription = LocalStrings.current.creationDate,
tint = ancillaryColor,
)
Text(
Expand All @@ -241,7 +242,7 @@ fun InboxReplySubtitle(
) {
Icon(
imageVector = Icons.Default.MoreHoriz,
contentDescription = null,
contentDescription = LocalStrings.current.actionOpenOptionMenu,
tint = ancillaryColor,
)
}
Expand All @@ -263,6 +264,7 @@ fun InboxReplySubtitle(
} else {
ancillaryColor
},
contentDescription = LocalStrings.current.actionUpvote,
onClick = {
onUpVote?.invoke()
},
Expand Down Expand Up @@ -300,6 +302,7 @@ fun InboxReplySubtitle(
} else {
ancillaryColor
},
contentDescription = LocalStrings.current.actionDownvote,
onClick = {
onDownVote?.invoke()
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import com.livefast.eattrash.raccoonforlemmy.core.appearance.theme.ancillaryText
import com.livefast.eattrash.raccoonforlemmy.core.commonui.components.CustomDropDown
import com.livefast.eattrash.raccoonforlemmy.core.commonui.components.CustomImage
import com.livefast.eattrash.raccoonforlemmy.core.commonui.components.PlaceholderImage
import com.livefast.eattrash.raccoonforlemmy.core.l10n.LocalStrings
import com.livefast.eattrash.raccoonforlemmy.core.persistence.data.MultiCommunityModel
import com.livefast.eattrash.raccoonforlemmy.core.utils.toLocalDp

Expand Down Expand Up @@ -106,7 +107,7 @@ fun MultiCommunityItem(
) {
Icon(
imageVector = Icons.Default.MoreVert,
contentDescription = null,
contentDescription = LocalStrings.current.actionOpenOptionMenu,
tint = ancillaryColor,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ private fun CompactPost(
loadButtonContent = @Composable {
Icon(
imageVector = Icons.Default.Download,
contentDescription = null,
contentDescription = LocalStrings.current.actionDownload,
)
},
blurred = blurNsfw && post.nsfw,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import com.livefast.eattrash.raccoonforlemmy.core.appearance.theme.readContentAl
import com.livefast.eattrash.raccoonforlemmy.core.commonui.components.CustomDropDown
import com.livefast.eattrash.raccoonforlemmy.core.commonui.components.CustomizedContent
import com.livefast.eattrash.raccoonforlemmy.core.commonui.components.FeedbackButton
import com.livefast.eattrash.raccoonforlemmy.core.l10n.LocalStrings
import com.livefast.eattrash.raccoonforlemmy.core.utils.VoteAction
import com.livefast.eattrash.raccoonforlemmy.core.utils.compose.onClick
import com.livefast.eattrash.raccoonforlemmy.core.utils.datetime.prettifyDate
Expand Down Expand Up @@ -128,7 +129,7 @@ fun PostCardFooter(
) {
Icon(
imageVector = Icons.AutoMirrored.Default.Chat,
contentDescription = null,
contentDescription = LocalStrings.current.actionReply,
tint = ancillaryColor,
)
}
Expand Down Expand Up @@ -180,7 +181,7 @@ fun PostCardFooter(
} else {
Icons.Default.Schedule
},
contentDescription = null,
contentDescription = LocalStrings.current.creationDate,
tint = ancillaryColor,
)
Text(
Expand All @@ -206,7 +207,7 @@ fun PostCardFooter(
) {
Icon(
imageVector = Icons.Default.MoreHoriz,
contentDescription = null,
contentDescription = LocalStrings.current.actionOpenOptionMenu,
tint = ancillaryColor,
)
}
Expand All @@ -233,6 +234,7 @@ fun PostCardFooter(
ancillaryColor
},
enabled = actionButtonsActive,
contentDescription = LocalStrings.current.actionAddToBookmarks,
onClick = {
onSave?.invoke()
},
Expand All @@ -251,6 +253,7 @@ fun PostCardFooter(
ancillaryColor
},
enabled = actionButtonsActive,
contentDescription = LocalStrings.current.actionUpvote,
onClick = {
onUpVote?.invoke()
},
Expand Down Expand Up @@ -289,6 +292,7 @@ fun PostCardFooter(
ancillaryColor
},
enabled = actionButtonsActive,
contentDescription = LocalStrings.current.actionDownvote,
onClick = {
onDownVote?.invoke()
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ fun PostCardImage(
} else {
Icons.Default.Visibility
},
contentDescription = null,
contentDescription = LocalStrings.current.actionToggleVisibility,
tint = MaterialTheme.colorScheme.onBackground,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ fun PostCardVideo(
) {
Icon(
imageVector = Icons.Default.Fullscreen,
contentDescription = null,
contentDescription = LocalStrings.current.actionOpenFullScreen,
)
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.text.style.TextOverflow
import com.livefast.eattrash.raccoonforlemmy.core.appearance.theme.CornerSize
import com.livefast.eattrash.raccoonforlemmy.core.appearance.theme.Spacing
import com.livefast.eattrash.raccoonforlemmy.core.l10n.LocalStrings
import com.livefast.eattrash.raccoonforlemmy.core.utils.compose.onClick

@Composable
Expand Down Expand Up @@ -50,7 +51,7 @@ fun PostLinkBanner(
)
Icon(
imageVector = Icons.Default.Link,
contentDescription = null,
contentDescription = LocalStrings.current.actionOpen,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import com.livefast.eattrash.raccoonforlemmy.core.appearance.theme.CornerSize
import com.livefast.eattrash.raccoonforlemmy.core.appearance.theme.Spacing
import com.livefast.eattrash.raccoonforlemmy.core.appearance.theme.ancillaryTextAlpha
import com.livefast.eattrash.raccoonforlemmy.core.commonui.components.CustomImage
import com.livefast.eattrash.raccoonforlemmy.core.l10n.LocalStrings

@Composable
fun SettingsImageInfo(
Expand Down Expand Up @@ -75,7 +76,7 @@ fun SettingsImageInfo(
) {
Icon(
imageVector = Icons.Default.FileOpen,
contentDescription = null,
contentDescription = LocalStrings.current.actionOpen,
tint = MaterialTheme.colorScheme.onBackground,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import androidx.compose.ui.unit.dp
import com.livefast.eattrash.raccoonforlemmy.core.appearance.theme.Spacing
import com.livefast.eattrash.raccoonforlemmy.core.appearance.theme.ancillaryTextAlpha
import com.livefast.eattrash.raccoonforlemmy.core.commonui.components.FeedbackButton
import com.livefast.eattrash.raccoonforlemmy.core.l10n.LocalStrings

@Composable
fun SettingsIntValueRow(
Expand Down Expand Up @@ -57,6 +58,7 @@ fun SettingsIntValueRow(
FeedbackButton(
imageVector = Icons.Default.RemoveCircleOutline,
tintColor = MaterialTheme.colorScheme.secondary,
contentDescription = LocalStrings.current.actionDecrement,
onClick = onDecrement,
)
Text(
Expand All @@ -72,6 +74,7 @@ fun SettingsIntValueRow(
FeedbackButton(
imageVector = Icons.Default.AddCircleOutline,
tintColor = MaterialTheme.colorScheme.secondary,
contentDescription = LocalStrings.current.actionIncrement,
onClick = onIncrement,
)
}
Expand Down
Loading

0 comments on commit 12b5a79

Please # to comment.