Skip to content

Commit f958365

Browse files
committed
feat(search bar): add shortcuts CRTL + F or F3 to select the search bar
fixes #213
1 parent 29c17b1 commit f958365

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ This web user interface uses [Riot](https://github.com/Riot/riot) the react-like
4646
- 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))
4747
- Set a list of default registries with `DEFAULT_REGISTRIES` (see [#219](https://github.com/Joxit/docker-registry-ui/pull/219)).
4848
- Desactivate add and remove regisitries with `READ_ONLY_REGISTRIES` (see [#219](https://github.com/Joxit/docker-registry-ui/pull/219)).
49+
- 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)).
4950

5051
## FAQ
5152

src/components/search-bar.riot

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@
2020
input.value = '';
2121
notify();
2222
})
23+
window.addEventListener('keydown', e => {
24+
// F3 or CTRL + F
25+
if (e.keyCode === 114 || (e.ctrlKey && e.keyCode === 70)) {
26+
// already focused, fallback to default behavior
27+
if (document.activeElement === input) {
28+
return true;
29+
} else {
30+
e.preventDefault();
31+
input.focus();
32+
}
33+
}
34+
})
2335
}
2436
}
2537

0 commit comments

Comments
 (0)