Skip to content

Commit

Permalink
feat(search bar): add shortcuts CRTL + F or F3 to select the se…
Browse files Browse the repository at this point in the history
…arch bar

fixes #213
  • Loading branch information
Joxit committed Nov 6, 2021
1 parent 29c17b1 commit f958365
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ This web user interface uses [Riot](https://github.com/Riot/riot) the react-like
- Multi arch support in history page (see [#130](https://github.com/Joxit/docker-registry-ui/issues/130) and [#134](https://github.com/Joxit/docker-registry-ui/pull/134))
- Set a list of default registries with `DEFAULT_REGISTRIES` (see [#219](https://github.com/Joxit/docker-registry-ui/pull/219)).
- Desactivate add and remove regisitries with `READ_ONLY_REGISTRIES` (see [#219](https://github.com/Joxit/docker-registry-ui/pull/219)).
- Filter images and tags with a search bar. You can select the search bar with the shortcut `CRTL` + `F` or `F3`. When the search bar is already focused, the shortcut will fallback to the default behavior (see [#213](https://github.com/Joxit/docker-registry-ui/issues/213)).

## FAQ

Expand Down
12 changes: 12 additions & 0 deletions src/components/search-bar.riot
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@
input.value = '';
notify();
})
window.addEventListener('keydown', e => {
// F3 or CTRL + F
if (e.keyCode === 114 || (e.ctrlKey && e.keyCode === 70)) {
// already focused, fallback to default behavior
if (document.activeElement === input) {
return true;
} else {
e.preventDefault();
input.focus();
}
}
})
}
}
Expand Down

0 comments on commit f958365

Please sign in to comment.