diff --git a/Localization/StringsConvertor/input/Base.lproj/app.json b/Localization/StringsConvertor/input/Base.lproj/app.json index d157462f1..20271d6af 100644 --- a/Localization/StringsConvertor/input/Base.lproj/app.json +++ b/Localization/StringsConvertor/input/Base.lproj/app.json @@ -107,7 +107,11 @@ "home": "Home", "search_and_explore": "Search and Explore", "notifications": "Notifications", - "profile": "Profile" + "profile": "Profile", + "a11y": { + "search": "Search", + "explore": "Explore" + } }, "keyboard": { "common": { diff --git a/Localization/app.json b/Localization/app.json index df9f234ea..07a158b2a 100644 --- a/Localization/app.json +++ b/Localization/app.json @@ -108,7 +108,11 @@ "home": "Home", "search_and_explore": "Search and Explore", "notifications": "Notifications", - "profile": "Profile" + "profile": "Profile", + "a11y": { + "search": "Search", + "explore": "Explore" + } }, "keyboard": { "common": { diff --git a/Mastodon/Scene/Root/MainTab/MainTabBarController.swift b/Mastodon/Scene/Root/MainTab/MainTabBarController.swift index a205320c8..0aeed3e37 100644 --- a/Mastodon/Scene/Root/MainTab/MainTabBarController.swift +++ b/Mastodon/Scene/Root/MainTab/MainTabBarController.swift @@ -67,6 +67,19 @@ class MainTabBarController: UITabBarController { case .me: return L10n.Common.Controls.Tabs.profile } } + + var inputLabels: [String]? { + switch self { + case .home, .compose, .notifications, .me: + return nil + case .search: + return [ + L10n.Common.Controls.Tabs.A11Y.search, + L10n.Common.Controls.Tabs.A11Y.explore, + L10n.Common.Controls.Tabs.searchAndExplore + ] + } + } var image: UIImage { switch self { @@ -205,12 +218,20 @@ extension MainTabBarController { viewController.tabBarItem.selectedImage = tab.selectedImage.imageWithoutBaseline() viewController.tabBarItem.largeContentSizeImage = tab.largeImage.imageWithoutBaseline() viewController.tabBarItem.accessibilityLabel = tab.title + viewController.tabBarItem.accessibilityUserInputLabels = tab.inputLabels viewController.tabBarItem.imageInsets = UIEdgeInsets(top: 6, left: 0, bottom: -6, right: 0) return viewController } _viewControllers = viewControllers setViewControllers(viewControllers, animated: false) selectedIndex = 0 + + // hacky workaround for FB11986255 (Setting accessibilityUserInputLabels on a UITabBarItem has no effect) + DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(50)) { + if let searchItem = self.tabBar.subviews.first(where: { $0.accessibilityLabel == Tab.search.title }) { + searchItem.accessibilityUserInputLabels = Tab.search.inputLabels + } + } context.apiService.error .receive(on: DispatchQueue.main) diff --git a/MastodonSDK/Sources/MastodonLocalization/Generated/Strings.swift b/MastodonSDK/Sources/MastodonLocalization/Generated/Strings.swift index 5edada3df..ae8b631b9 100644 --- a/MastodonSDK/Sources/MastodonLocalization/Generated/Strings.swift +++ b/MastodonSDK/Sources/MastodonLocalization/Generated/Strings.swift @@ -452,6 +452,12 @@ public enum L10n { public static let profile = L10n.tr("Localizable", "Common.Controls.Tabs.Profile", fallback: "Profile") /// Search and Explore public static let searchAndExplore = L10n.tr("Localizable", "Common.Controls.Tabs.SearchAndExplore", fallback: "Search and Explore") + public enum A11Y { + /// Explore + public static let explore = L10n.tr("Localizable", "Common.Controls.Tabs.A11Y.Explore", fallback: "Explore") + /// Search + public static let search = L10n.tr("Localizable", "Common.Controls.Tabs.A11Y.Search", fallback: "Search") + } } public enum Timeline { /// Filtered diff --git a/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings b/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings index ef1a38c5a..8dc1893f2 100644 --- a/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings +++ b/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings @@ -156,6 +156,8 @@ Please check your internet connection."; "Common.Controls.Status.EditedAtTimestampPrefix" = "Edited %@"; "Common.Controls.Status.EditHistory.Title" = "Edit History"; "Common.Controls.Status.EditHistory.OriginalPost" = "Original Post ยท %@"; +"Common.Controls.Tabs.A11Y.Explore" = "Explore"; +"Common.Controls.Tabs.A11Y.Search" = "Search"; "Common.Controls.Tabs.Home" = "Home"; "Common.Controls.Tabs.Notifications" = "Notifications"; "Common.Controls.Tabs.Profile" = "Profile";