正如所描述的Github - 键盘快捷键,s是聚焦搜索栏的快捷方式。可以禁用该功能吗?
答案1
经过修改这评论
安装 Grease Monkey (FF) 并使用此脚本
// Your code here...
// ==UserScript==
// @name Disable keyboard shortcuts
// @description Stop websites from highjacking keyboard shortcuts
//
// @run-at document-start
// @include *github.com*
// @grant none
// ==/UserScript==
keycodes = [83] // Keycode for 'S', add more keycodes to disable other key captures
document.addEventListener('keydown', function(e) {
// alert(e.keyCode); //uncomment to find out the keycode for any given key
if (keycodes.indexOf(e.keyCode) != -1)
{
e.cancelBubble = true;
e.stopImmediatePropagation();
}
return false;
});
或者下载 TamperMonkey(Chrome)并使用此脚本
// Your code here...
// ==UserScript==
// @name Disable keyboard shortcuts
// @description Stop websites from highjacking keyboard shortcuts
//
// @run-at document-start
// @include *github.com*
// @grant none
// ==/UserScript==
document.addEventListener('keydown', function(e) {
if (e.keyCode == 83) {
e.cancelBubble = true;
e.stopImmediatePropagation();
}
return false;
});