A simple example, no code needed:
If I press CTRL + F
, the browser automatically opens a search bar on the page.
I made that by pressing CTRL + F
it would point to an input inside the system.
I want to put several other controllers, such as changing a boostrap tab with CTRL + TAB
, closing a modal with ESC
. open the internal help with F11
among others.
Examples:
To navigate between tabs using CTRL + SETA
var change_tab = function () {
var map = {37: false, 39: false, 17: false};
$(document).keydown(function (e) {
if (e.keyCode in map) {
map[e.keyCode] = true;
if (map[37] && map[17]) {
var $el = $('.nav.nav-tabs').find('li');
$el.each(function () {
if ($(this).hasClass('active') === true) {
$(this).prev('li').find('a').trigger('click');
}
});
}
if (map[39] && map[17]) {
var $el = $('.nav.nav-tabs').find('li');
$el.each(function () {
if ($(this).hasClass('active') === true) {
$(this).next('li').find('a').trigger('click');
}
});
}
}
}).keyup(function (e) {
if (e.keyCode in map) {
map[e.keyCode] = false;
}
});
}
To maximize a form with CTRL + F11
:
var make_full = function () {
var map = {17: false, 122: false};
$(document).keydown(function (e) {
if (e.keyCode in map) {
map[e.keyCode] = true;
if (map[17] && map[122]) {
$('.fullscreen').trigger('click');
}
}
}).keyup(function (e) {
if (e.keyCode in map) {
map[e.keyCode] = false;
}
});
}
The question is simple:
-
This type of practice is considered user friendly ?
-
Is there a problem in replacing the browser's shortcut keys with the keys I want to interact with in my system (EX:
CTRL + F
to open the search)?
PS: In the case in question the target is an internal system, it is not something to be marketed, I just need whoever it is to use, can do as many things in the shortest possible time, since the system focus is