fix: pick sever search bar accessible a11y issue

This commit is contained in:
CMK 2022-04-18 16:56:29 +08:00
parent 41e1b75c62
commit 7772783555
3 changed files with 8 additions and 11 deletions

View File

@ -73,7 +73,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
enableAddressSanitizer = "YES"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
@ -90,13 +89,6 @@
ReferencedContainer = "container:Mastodon.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
<AdditionalOption
key = "NSZombieEnabled"
value = "YES"
isEnabled = "YES">
</AdditionalOption>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

View File

@ -185,12 +185,12 @@ extension PickServerServerSectionTableHeaderView {
override func accessibilityElementCount() -> Int {
guard let diffableDataSource = diffableDataSource else { return 0 }
return diffableDataSource.snapshot().itemIdentifiers.count
return diffableDataSource.snapshot().itemIdentifiers.count + 1
}
override func accessibilityElement(at index: Int) -> Any? {
guard let item = collectionView.cellForItem(at: IndexPath(item: index, section: 0)) else { return nil }
return item
if let item = collectionView.cellForItem(at: IndexPath(item: index, section: 0)) { return item }
return searchTextField
}
}

View File

@ -51,6 +51,11 @@ extension NewsTableViewCell {
separatorLine.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
separatorLine.heightAnchor.constraint(equalToConstant: UIView.separatorLineHeight(of: contentView)),
])
isAccessibilityElement = true
accessibilityElements = [
newsView
]
}
}