After several tests, it seems that the shortcut ctrl+H only works when i launche a preview in a new tab. When the preview is launched in a new browser window, the shortcut ctrl+H seems to have no effect on the preview window, but this is independant from your script : if i disable the script, this shortcut remains inactive on the preview window. This is probably inherant to this particular shortcut.
Shortcuts like ctrl+D or ctrl+S will still remains active on the preview window (or preview tab, i tested both), even if i put "KeyD" instead of "KeyH" in the script in your test project.