0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

New Relic でも ctrl-h で backspace したい

Last updated at Posted at 2022-01-18

何が起きたか

New Relic One には謎のキーバインドが張られており、ctrl-h を押すと前のページに戻ってしまう。ctrl-h で backspace したい派としては、クエリの入力欄でミスタイプしてctrl-hで消そうとするたびに前のページに戻ってしまい不便だった。

解決策

New Relic がバインドしてくる keydown イベントを stopPropagation しちゃえばいい。

document.addEventListener('keydown', (event) => {
    if (event.key === 'h' && event.ctrlKey) event.stopPropagation()
})

これを TampermonkeyGreasemonkey で New Relic にアクセスするたびに実行させればいい感じになる。 userscript 版は gist に置いた。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?