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

Unified Diff: ui/file_manager/file_manager/foreground/js/ui/search_box.js

Issue 1017863005: [Files.app] Fix the tabindex around search box (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adressed comment. Created 5 years, 9 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 | ui/file_manager/integration_tests/file_manager/tab_index.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/file_manager/foreground/js/ui/search_box.js
diff --git a/ui/file_manager/file_manager/foreground/js/ui/search_box.js b/ui/file_manager/file_manager/foreground/js/ui/search_box.js
index 3ed4f992322c20554a7ffce9395d7b911fc775d5..6392a6361333e9f449dce7ac83bf101b130de1e4 100644
--- a/ui/file_manager/file_manager/foreground/js/ui/search_box.js
+++ b/ui/file_manager/file_manager/foreground/js/ui/search_box.js
@@ -194,8 +194,8 @@ SearchBox.prototype.onInput_ = function() {
*/
SearchBox.prototype.onFocus_ = function() {
this.element.classList.toggle('has-cursor', true);
- this.inputElement.tabIndex = '99'; // See: go/filesapp-tabindex.
this.autocompleteList.attachToInput(this.inputElement);
+ this.updateStyles_();
};
/**
@@ -204,8 +204,8 @@ SearchBox.prototype.onFocus_ = function() {
*/
SearchBox.prototype.onBlur_ = function() {
this.element.classList.toggle('has-cursor', false);
- this.inputElement.tabIndex = '-1';
this.autocompleteList.detach();
+ this.updateStyles_();
};
/**
@@ -216,8 +216,10 @@ SearchBox.prototype.onBlur_ = function() {
SearchBox.prototype.onKeyDown_ = function(event) {
event = /** @type {KeyboardEvent} */ (event);
// Handle only Esc key now.
- if (event.keyCode != 27 || this.inputElement.value)
+ if (event.keyIdentifier != 'U+001B' /* Esc */ || this.inputElement.value)
return;
+
+ this.inputElement.tabIndex = '-1'; // Focus to default element after blur.
this.inputElement.blur();
};
@@ -248,8 +250,13 @@ SearchBox.prototype.onDragEnd_ = function() {
* @private
*/
SearchBox.prototype.updateStyles_ = function() {
- this.element.classList.toggle('has-text',
- !!this.inputElement.value);
+ var hasText = !!this.inputElement.value;
+ this.element.classList.toggle('has-text', hasText);
+ var hasFocusOnInput = this.element.classList.contains('has-cursor');
+
+ // See go/filesapp-tabindex for tabindexes.
+ this.inputElement.tabIndex = (hasText || hasFocusOnInput) ? '13' : '-1';
+ this.searchButton.tabIndex = (hasText || hasFocusOnInput) ? '-1' : '12';
};
/**
« no previous file with comments | « no previous file | ui/file_manager/integration_tests/file_manager/tab_index.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698