• Robert Knight's avatar
    Fix error if `matchShortcut` is called with non-KeyboardEvent · 54cae019
    Robert Knight authored
    Work around an exception when testing for shortcuts in `keydown` event handlers,
    if the handler is called with an argument that is not a `KeyboardEvent`, and is
    missing the expected `key` property. The workaround has been added to
    `matchShortcut` because it is easier to do there than remember for each
    `keydown` event handler, although there is a risk that other code in these
    handlers could get caught out by the same issue.
    
    I was able to reproduce this problem locally in Chrome 118 when using autofill
    to insert text into the search input field (see comments), though there might be
    other causes as well.
    
    This should fix https://hypothesis.sentry.io/issues/3987386810/?project=69811
    54cae019
shortcut.ts 4.16 KB