Skip to content

Commit

Permalink
Fixed global-search keyboard shortcut for non-english keyboard layouts.
Browse files Browse the repository at this point in the history
Closes #10646
  • Loading branch information
apollo13 committed Jun 7, 2021
1 parent bdf2555 commit 9d948a8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ BUG FIXES:
* drivers/exec: Fixed a bug where `exec` and `java` tasks inherit the Nomad agent's `oom_score_adj` value [[GH-10698](https://github.com/hashicorp/nomad/issues/10698)]
* quotas (Enterprise): Fixed a bug where stopped allocations for a failed deployment can be double-credited to quota limits, resulting in a quota limit bypass. [[GH-10694](https://github.com/hashicorp/nomad/issues/10694)]
* ui: Fixed a bug where exec would not work across regions. [[GH-10539](https://github.com/hashicorp/nomad/issues/10539)]
* ui: Fixed global-search shortcut for non-english keyboards. [[GH-10714](https://github.com/hashicorp/nomad/issues/10714)]

## 1.1.0 (May 18, 2021)

Expand Down
4 changes: 2 additions & 2 deletions ui/app/components/global-search/control.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { action, set } from '@ember/object';
import { inject as service } from '@ember/service';
import { debounce, run } from '@ember/runloop';

const SLASH_KEY = 191;
const SLASH_KEY = '/';
const MAXIMUM_RESULTS = 10;

@classNames('global-search-container')
Expand All @@ -24,7 +24,7 @@ export default class GlobalSearchControl extends Component {
const targetElementName = e.target.nodeName.toLowerCase();

if (targetElementName != 'input' && targetElementName != 'textarea') {
if (e.keyCode === SLASH_KEY) {
if (e.key === SLASH_KEY) {
e.preventDefault();
this.open();
}
Expand Down
6 changes: 2 additions & 4 deletions ui/tests/acceptance/search-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,7 @@ module('Acceptance | search', function(hooks) {

assert.notOk(Layout.navbar.search.field.isPresent);

await triggerEvent('.page-layout', 'keydown', {
keyCode: 191, // slash
});
await triggerEvent('.page-layout', 'keydown', { key: '/' });

assert.ok(Layout.navbar.search.field.isPresent);
});
Expand All @@ -177,7 +175,7 @@ module('Acceptance | search', function(hooks) {
assert.notOk(Layout.navbar.search.field.isPresent);

await JobsList.search.click();
await JobsList.search.keydown({ keyCode: 191 });
await JobsList.search.keydown({ key: '/' });

assert.notOk(Layout.navbar.search.field.isPresent);
});
Expand Down

0 comments on commit 9d948a8

Please sign in to comment.