| 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';
|
| };
|
|
|
| /**
|
|
|