mirror of
https://github.com/yattee/yattee.git
synced 2026-10-25 06:02:57 +00:00
Give the empty tvOS import screens a focusable Done button
With nothing to import, the playlists and subscriptions import screens had no focusable content; only the container's toolbar Done, which is not a dependable focus target on tvOS.
This commit is contained in:
@@ -11,6 +11,9 @@ struct ImportPlaylistsView: View {
|
||||
let instance: Instance
|
||||
|
||||
@Environment(\.appEnvironment) private var appEnvironment
|
||||
#if os(tvOS)
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
#endif
|
||||
|
||||
@State private var playlists: [Playlist] = []
|
||||
@State private var importedPlaylistIDs: Set<String> = []
|
||||
@@ -177,11 +180,19 @@ struct ImportPlaylistsView: View {
|
||||
}
|
||||
|
||||
private var emptyView: some View {
|
||||
ContentUnavailableView(
|
||||
String(localized: "import.playlists.emptyTitle"),
|
||||
systemImage: "list.bullet.rectangle",
|
||||
description: Text(String(localized: "import.playlists.emptyDescription"))
|
||||
)
|
||||
ContentUnavailableView {
|
||||
Label(String(localized: "import.playlists.emptyTitle"), systemImage: "list.bullet.rectangle")
|
||||
} description: {
|
||||
Text(String(localized: "import.playlists.emptyDescription"))
|
||||
} actions: {
|
||||
#if os(tvOS)
|
||||
// Nothing in the content is focusable here; the container's
|
||||
// toolbar Done is not something to rely on to keep the remote free.
|
||||
Button(String(localized: "common.done")) {
|
||||
dismiss()
|
||||
}
|
||||
#endif
|
||||
}
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.accessibilityIdentifier(AccessibilityID.emptyState)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user