Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve bookmark button accessibility #502

Merged
merged 3 commits into from
Aug 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import androidx.compose.material.icons.filled.Person
import androidx.compose.material.icons.outlined.BookmarkBorder
import androidx.compose.material3.Divider
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.IconButtonDefaults
import androidx.compose.material3.IconToggleButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
Expand All @@ -35,6 +36,7 @@ import io.github.droidkaigi.confsched2023.designsystem.theme.md_theme_light_outl
import io.github.droidkaigi.confsched2023.model.TimetableItem
import io.github.droidkaigi.confsched2023.model.TimetableItem.Session
import io.github.droidkaigi.confsched2023.model.fake
import io.github.droidkaigi.confsched2023.sessions.SessionsStrings
import io.github.droidkaigi.confsched2023.ui.previewOverride
import io.github.droidkaigi.confsched2023.ui.rememberAsyncImagePainter

Expand All @@ -59,19 +61,25 @@ fun TimetableListItem(
Row(modifier = Modifier.weight(1F)) {
chipContent()
}
IconButton(
IconToggleButton(
modifier = Modifier.testTag(TimetableListItemBookmarkIconTestTag),
onClick = {
onBoomarkClick(timetableItem)
},
checked = isBookmarked,
onCheckedChange = { onBoomarkClick(timetableItem) },
colors = IconButtonDefaults.iconToggleButtonColors(
checkedContentColor = MaterialTheme.colorScheme.onSurface,
),
) {
Icon(
imageVector = if (isBookmarked) {
Icons.Filled.Bookmark
} else {
Icons.Outlined.BookmarkBorder
},
contentDescription = null,
contentDescription = if (isBookmarked) {
SessionsStrings.RemoveFromFavorites.asString()
} else {
SessionsStrings.AddToFavorites.asString()
},
)
}
}
Expand Down
Loading