Customize Keyboard Shortcuts

TLDR; is it possible to customize Keyboard Shortcuts, perhaps via a plugin?

Hi! I’m scoping out Grist and love the spreadsheets-like UI. I’m used to slightly different shortcuts, so being able to customize navigation would help me get oriented more quickly. Specifically, in my case I’m used to CTRL+Left and CTRL+Right taking you to the left or right sides of a sequence of data-filled-cells, and/or to the front or end of a row. From the Shortcuts help page I see Home and End at least take care of the left and right sides of a row, and that CTRL+Up and CTRL+Down will navigate to the top and bottom of a sheet.

CTRL+Left and CTRL+Right seem to do in-app back and forth page navigation. I didn’t see that documented on the Shortcuts help page, but I’m using Firefox so unsure if that’s an edge case.

At any rate, I saw Shortcuts are defined here and was wondering if there was a way to customize them? Perhaps it’d be possible to hook into the groups via a plugin?

2 Likes

I asked the same question via email to support recently - apparently there isn’t currently, but they forwarded my question/complaint to the team to see if it could go on the list.

My beef is that F2 does something in my browser (Vivaldi), which I can’t do on a Grist page, so I’d like a way to remove or change that

I would also like the feature to customize keyboard shortcuts. In Microsoft Edge I like to use CTRL-SHIFT-A to switch between tabs but doesn’t work when on a grist tab.

Current workaround I am using for CTRL-SHIFT-A with the help of ChatGPT was to use the following script in Tampermonkey. Can also add additional @match lines if you are hosting grist locally.

// ==UserScript==
// @name         Grist: let Edge have Ctrl+Shift+A (Tab Search)
// @namespace    local
// @version      1.0
// @description  Stops Grist from handling Ctrl+Shift+A so Edge can open Tab Search.
// @match        https://*.getgrist.com/*
// @match        https://docs.getgrist.com/*
// @match        https://*.grist.*/*
// @run-at       document-start
// ==/UserScript==

(function () {
  "use strict";

  function isCtrlShiftA(e) {
    // Prefer `code` (layout-independent). Fallback to key.
    return e.ctrlKey && e.shiftKey && (e.code === "KeyA" || e.key === "A" || e.key === "a");
  }

  // Use CAPTURE phase and register at document-start to beat app listeners.
  window.addEventListener(
    "keydown",
    (e) => {
      if (!isCtrlShiftA(e)) return;

      // Important: do NOT call preventDefault().
      // We only stop Grist (page JS) from seeing it.
      e.stopImmediatePropagation();
      e.stopPropagation();
    },
    true
  );
})();