Fix read filter accessibility labels (help)

This commit is contained in:
Maurice Parker 2020-07-12 15:03:43 -05:00
parent 6c236fc0e3
commit 2ebec7801c
4 changed files with 15 additions and 5 deletions

View File

@ -30,7 +30,7 @@ struct SidebarToolbarModifier: ViewModifier {
} else { } else {
AppAssets.filterInactiveImage.font(.title3) AppAssets.filterInactiveImage.font(.title3)
} }
}).help("Filter Read Feeds") }).help(sidebarModel.isReadFiltered ? "Show Read Feeds" : "Filter Read Feeds")
} }
ToolbarItem(placement: .automatic) { ToolbarItem(placement: .automatic) {

View File

@ -35,6 +35,7 @@ struct SidebarView: View {
}) })
.padding(.top, 8).padding(.trailing) .padding(.top, 8).padding(.trailing)
.buttonStyle(PlainButtonStyle()) .buttonStyle(PlainButtonStyle())
.help(sidebarModel.isReadFiltered ? "Show Read Feeds" : "Filter Read Feeds")
} }
ZStack { ZStack {
NavigationLink(destination: TimelineContainerView(feeds: sidebarModel.selectedFeeds), isActive: $navigate) { NavigationLink(destination: TimelineContainerView(feeds: sidebarModel.selectedFeeds), isActive: $navigate) {

View File

@ -10,16 +10,24 @@ import SwiftUI
struct TimelineToolbarModifier: ViewModifier { struct TimelineToolbarModifier: ViewModifier {
@EnvironmentObject private var timelineModel: TimelineModel
func body(content: Content) -> some View { func body(content: Content) -> some View {
content content
.toolbar { .toolbar {
#if os(iOS) #if os(iOS)
ToolbarItem(placement: .navigation) { ToolbarItem(placement: .navigation) {
Button(action: { Button (action: {
withAnimation {
timelineModel.isReadFiltered.toggle()
}
}, label: { }, label: {
AppAssets.filterInactiveImage if timelineModel.isReadFiltered {
.font(.title3) AppAssets.filterActiveImage.font(.title3)
}).help("Filter Read Articles") } else {
AppAssets.filterInactiveImage.font(.title3)
}
}).help(timelineModel.isReadFiltered ? "Show Read Articles" : "Filter Read Articles")
} }
ToolbarItem { ToolbarItem {

View File

@ -31,6 +31,7 @@ struct TimelineView: View {
}) })
.padding(.top, 8).padding(.trailing) .padding(.top, 8).padding(.trailing)
.buttonStyle(PlainButtonStyle()) .buttonStyle(PlainButtonStyle())
.help(timelineModel.isReadFiltered ? "Show Read Articles" : "Filter Read Articles")
} }
ZStack { ZStack {
NavigationLink(destination: ArticleContainerView(articles: timelineModel.selectedArticles), isActive: $navigate) { NavigationLink(destination: ArticleContainerView(articles: timelineModel.selectedArticles), isActive: $navigate) {