diff --git a/Shared/PostList/PostListView.swift b/Shared/PostList/PostListView.swift
index e20651a..0f9e371 100644
--- a/Shared/PostList/PostListView.swift
+++ b/Shared/PostList/PostListView.swift
@@ -20,33 +20,44 @@ struct PostListView: View {
)
.toolbar {
ToolbarItem(placement: .primaryAction) {
- Button(action: {
- let managedPost = WFAPost(context: self.managedObjectContext)
- managedPost.createdDate = Date()
- managedPost.title = ""
- managedPost.body = ""
- managedPost.status = PostStatus.local.rawValue
- managedPost.collectionAlias = nil
- switch model.preferences.font {
- case 1:
- managedPost.appearance = "sans"
- case 2:
- managedPost.appearance = "wrap"
- default:
- managedPost.appearance = "serif"
- }
- if let languageCode = Locale.current.languageCode {
- managedPost.language = languageCode
- managedPost.rtl = Locale.characterDirection(forLanguage: languageCode) == .rightToLeft
- }
- withAnimation {
- self.selectedCollection = nil
- self.showAllPosts = false
- self.model.selectedPost = managedPost
- }
- }, label: {
- Image(systemName: "square.and.pencil")
- })
+ // We have to add a Spacer as a sibling view to the Button in some kind of Stack, so that any a11y
+ // modifiers are applied as expected: bug report filed as FB8956392.
+ ZStack {
+ Spacer()
+ Button(action: {
+ let managedPost = WFAPost(context: self.managedObjectContext)
+ managedPost.createdDate = Date()
+ managedPost.title = ""
+ managedPost.body = ""
+ managedPost.status = PostStatus.local.rawValue
+ managedPost.collectionAlias = nil
+ switch model.preferences.font {
+ case 1:
+ managedPost.appearance = "sans"
+ case 2:
+ managedPost.appearance = "wrap"
+ default:
+ managedPost.appearance = "serif"
+ }
+ if let languageCode = Locale.current.languageCode {
+ managedPost.language = languageCode
+ managedPost.rtl = Locale.characterDirection(forLanguage: languageCode) == .rightToLeft
+ }
+ withAnimation {
+ self.selectedCollection = nil
+ self.showAllPosts = false
+ self.model.selectedPost = managedPost
+ }
+ }, label: {
+ Image(systemName: "square.and.pencil")
+ .scaleEffect(1.25) // These modifiers compensate for the resizing
+ .padding(.vertical, 12) // done to the Image (and the button tap target)
+ .padding(.leading, 12) // by the SwiftUI layout system from adding a
+ .padding(.trailing, 8) // Spacer in this ZStack (FB8956392).
+ })
+ .accessibilityLabel(Text("Compose"))
+ .accessibilityHint(Text("Compose a new local draft"))
+ }
}
ToolbarItem(placement: .bottomBar) {
HStack {
@@ -55,6 +66,8 @@ struct PostListView: View {
}, label: {
Image(systemName: "gear")
})
+ .accessibilityLabel(Text("Settings"))
+ .accessibilityHint(Text("Open the Settings sheet"))
Spacer()
Text(postCount == 1 ? "\(postCount) post" : "\(postCount) posts")
.foregroundColor(.secondary)
@@ -70,6 +83,8 @@ struct PostListView: View {
}, label: {
Image(systemName: "arrow.clockwise")
})
+ .accessibilityLabel(Text("Refresh Posts"))
+ .accessibilityHint(Text("Fetch changes from the server"))
.disabled(!model.account.isLoggedIn)
}
}
diff --git a/WriteFreely-MultiPlatform.xcodeproj/xcuserdata/angelo.xcuserdatad/xcschemes/xcschememanagement.plist b/WriteFreely-MultiPlatform.xcodeproj/xcuserdata/angelo.xcuserdatad/xcschemes/xcschememanagement.plist
index 2723ebe..6cd8075 100644
--- a/WriteFreely-MultiPlatform.xcodeproj/xcuserdata/angelo.xcuserdatad/xcschemes/xcschememanagement.plist
+++ b/WriteFreely-MultiPlatform.xcodeproj/xcuserdata/angelo.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -7,12 +7,12 @@
WriteFreely-MultiPlatform (iOS).xcscheme_^#shared#^_
orderHint
- 0
+ 1
WriteFreely-MultiPlatform (macOS).xcscheme_^#shared#^_
orderHint
- 1
+ 0
diff --git a/iOS/PostEditor/RemoteChangePromptView.swift b/iOS/PostEditor/RemoteChangePromptView.swift
index 0807155..184d6b3 100644
--- a/iOS/PostEditor/RemoteChangePromptView.swift
+++ b/iOS/PostEditor/RemoteChangePromptView.swift
@@ -9,6 +9,8 @@ struct RemoteChangePromptView: View {
@Environment(\.horizontalSizeClass) var horizontalSizeClass
@State private var promptText: String = "This is placeholder prompt text. Replace it?"
@State private var promptIcon: Image = Image(systemName: "questionmark.square.dashed")
+ @State private var accessibilityLabel: String = "Replace"
+ @State private var accessibilityHint: String = "Replace this text with an accessibility hint"
@State var remoteChangeType: RemotePostChangeType
@State var buttonHandler: () -> Void
@@ -18,6 +20,8 @@ struct RemoteChangePromptView: View {
.font(horizontalSizeClass == .compact ? .caption : .body)
.foregroundColor(.secondary)
Button(action: buttonHandler, label: { promptIcon })
+ .accessibilityLabel(Text(accessibilityLabel))
+ .accessibilityHint(Text(accessibilityHint))
}
.padding(EdgeInsets(top: 10, leading: 20, bottom: 10, trailing: 20))
.background(Color(UIColor.secondarySystemBackground))
@@ -28,9 +32,13 @@ struct RemoteChangePromptView: View {
case .remoteCopyUpdated:
promptText = "Newer copy on server. Replace local copy?"
promptIcon = Image(systemName: "square.and.arrow.down")
+ accessibilityLabel = "Update post"
+ accessibilityHint = "Replace this post with the server version"
case .remoteCopyDeleted:
promptText = "Post deleted from server. Delete local copy?"
promptIcon = Image(systemName: "trash")
+ accessibilityLabel = "Delete"
+ accessibilityHint = "Delete this post from your device"
}
})
}
diff --git a/iOS/Settings/SettingsHeaderView.swift b/iOS/Settings/SettingsHeaderView.swift
index ca65578..090040b 100644
--- a/iOS/Settings/SettingsHeaderView.swift
+++ b/iOS/Settings/SettingsHeaderView.swift
@@ -15,6 +15,8 @@ struct SettingsHeaderView: View {
}, label: {
Image(systemName: "xmark.circle")
})
+ .accessibilityLabel(Text("Close"))
+ .accessibilityHint(Text("Dismiss the Settings sheet"))
}
Text("WriteFreely v\(Bundle.main.appMarketingVersion) (build \(Bundle.main.appBuildVersion))")
.font(.caption)