Skip to content

Ctrl+k Should disable default browser behavior

Context

Reported by @johnhope in #409976 (comment 1381433434).

Description

Highlighting text and pressing Ctrl + k should open the link dialog, which it does. However, at least in Firefox, this key combination also focuses the location bar for Search.

I guess this is a non-standard key combination because Slack also focuses their search bar on this key combination. However, I've always found this utterly frustrating in Slack as any other text editor I use (e.g. Google docs) uses it for the link dialog.

It's a small papercut and should be an easy fix, but I think we should prevent the default behavior of this key combination.

Implementation Guide

This is most likely a straightforward event.preventDefault() on the keypress event. I'm not sure where this occurs, however it's likely to apply to all browsers and so won't require browser-specific checks or anything. Even if Chrome doesn't use the keypress combination, extensions might. So I think it's fine to simply prevent the default behavior.

Edited by John Hope