Reclaiming my browser’s zoom out shortcut in ServiceNow

Keyboard shortcuts reference chart for ServiceNow displaying various Mac shortcuts using cmd, shift, and opt key combinations. Shows shortcuts for navigation, menus, and system features including favorites, search, admin menu, user impersonation, and workspace access.

Today, in small things that break my flow: ServiceNow capturing and overriding the default browser zoom out shortcut.

Why does it happen?

ServiceNow implements some useful keyboard shortcuts and event handlers, but they haven’t considered that we don’t all use the same keyboard layout.

This issue only happens if your "-" key is in the bottom right corner, like in a Spanish keyboard.

Virtual keyboard interface with a dark theme showing a standard QWERTY layout. Spanish keyboard layout with special characters including ñ. The hyphen/minus key is highlighted with a red square outline. The keyboard includes function keys, media control buttons, and navigation keys.

Because that’s where the "/" key is in a US keyboard.

If you have the "/" key in that position, congratulations! You can close this tab and do more interesting things!

Virtual keyboard interface with a dark theme showing a standard QWERTY layout. The forward slash key is highlighted with a red square outline. The keyboard includes function keys, navigation arrows, and media control buttons at the top row. The keyboard has a Spanish layout with special characters and symbols visible on various keys.

For the rest of this post, I’ll refer to the Mac shortcut: "CMD + -". But the same behaviour and fix apply to Windows users using "Ctrl + -".

Workaround

Here’s how I fixed it with a simple script in Tampermonkey:

// ==UserScript==
// @name         ServiceNow Zoom Fix
// @version      1.0
// @description  Restores browser's zoom functionality in ServiceNow
// @author       Rubén Ferrero
// @match        https://*.service-now.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=service-now.com
// @grant        none
// ==/UserScript==

(function() {
  'use strict';
  document.addEventListener('keydown', function(event) {
    if ((event.metaKey || event.ctrlKey) && event.key === '-') {
      // Stop ServiceNow from capturing this event
      event.stopPropagation();
      // Note: No preventDefault(), allowing browser's default behaviour
    }
  });
})();

Code language: JavaScript (javascript)

How it works

The script is as simple as possible:

  1. It adds an event listener for keyboard events at the document level
  2. When "CMD + -" (or "Ctrl + -") is detected, it calls stopPropagation()

The stopPropagation() method prevents the event from bubbling up to other handlers in ServiceNow that would otherwise capture it. By not calling preventDefault(), we allow the browser’s native functionality to proceed normally.

You can still access the list of shortcuts from the user menu (by the way, there’s a shortcut to open it: "CMD + Shift + U").

ServiceNow user menu showing profile options for a System Administrator. The menu displays the user's profile picture and includes navigation options: Profile, Preferences, Keyboard shortcuts (currently selected), Impersonate user, Elevate role, Printer friendly version, and Log out. The ServiceNow logo appears in the header.

How to use it

To implement this fix:

  1. Install the Tampermonkey extension in your browser.
  2. Create a new script and paste the code above.
  3. Save and enable the script.
  4. Reload your ServiceNow instance.

Now you can use "CMD + -" to zoom out in ServiceNow, just like you would on any other website.

New in Yokohama

The Yokohama release introduces the possibility of customising your keyboard shortcuts. [Kudos to Israel Baral for telling me about it]

Still buggy, unfortunately, and it requires changing it in every instance.