Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Unified Diff: ios/chrome/browser/ui/history/history_panel_view_controller.mm

Issue 2605023002: [ios] Prevents history navigation items from being voice-over selectable while not visible. (Closed)
Patch Set: Add comment for future refactoring. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/history/history_panel_view_controller.mm
diff --git a/ios/chrome/browser/ui/history/history_panel_view_controller.mm b/ios/chrome/browser/ui/history/history_panel_view_controller.mm
index 41be2faa97542d813293e05832e1e87c99454cf5..dda85311b65f20807387bd5fcbd396704fd99e72 100644
--- a/ios/chrome/browser/ui/history/history_panel_view_controller.mm
+++ b/ios/chrome/browser/ui/history/history_panel_view_controller.mm
@@ -45,6 +45,10 @@ CGFloat kShadowOpacity = 0.2f;
base::scoped_nsobject<UIView> _containerView;
// The header view.
base::scoped_nsobject<MDCAppBar> _appBar;
+ // Left bar button item for Search.
+ base::scoped_nsobject<UIBarButtonItem> _leftBarButtonItem;
+ // Right bar button item for Dismiss history action.
+ base::scoped_nsobject<UIBarButtonItem> _rightBarButtonItem;
}
// Closes history.
- (void)closeHistory;
@@ -145,15 +149,17 @@ CGFloat kShadowOpacity = 0.2f;
[_appBar addSubviewsToParent];
// Add navigation bar buttons.
- self.navigationItem.leftBarButtonItem =
- [ChromeIcon templateBarButtonItemWithImage:[ChromeIcon searchIcon]
- target:self
- action:@selector(enterSearchMode)];
- self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc]
+ _leftBarButtonItem.reset([[ChromeIcon
+ templateBarButtonItemWithImage:[ChromeIcon searchIcon]
+ target:self
+ action:@selector(enterSearchMode)] retain]);
+ self.navigationItem.leftBarButtonItem = _leftBarButtonItem;
+ _rightBarButtonItem.reset([[UIBarButtonItem alloc]
initWithTitle:l10n_util::GetNSString(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON)
style:UIBarButtonItemStylePlain
target:self
- action:@selector(closeHistory)] autorelease];
+ action:@selector(closeHistory)]);
+ self.navigationItem.rightBarButtonItem = _rightBarButtonItem;
[self configureNavigationBar];
}
@@ -351,10 +357,20 @@ CGFloat kShadowOpacity = 0.2f;
[[searchBarView widthAnchor] constraintEqualToAnchor:headerView.widthAnchor]
];
[NSLayoutConstraint activateConstraints:constraints];
+ // Workaround so navigationItems are not voice-over selectable while hidden by
+ // the search view. We might have to re factor the view hierarchy in order to
+ // properly solve this issue. See: https://codereview.chromium.org/2605023002/
+ self.navigationItem.leftBarButtonItem = nil;
+ self.navigationItem.rightBarButtonItem = nil;
}
- (void)exitSearchMode {
if (_historyCollectionController.get().searching) {
+ // Resets the navigation items to their initial state.
+ self.navigationItem.leftBarButtonItem = _leftBarButtonItem;
+ self.navigationItem.rightBarButtonItem = _rightBarButtonItem;
+ [self configureNavigationBar];
+
[[_searchViewController view] removeFromSuperview];
[_searchViewController removeFromParentViewController];
_historyCollectionController.get().searching = NO;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698