25

I use Safari in Full Screen mode on OS X Mavericks all the time. I also use the escape key in web pages fairly frequently for various things (depends on the webpage).

One unfortunate side effect of these two facts is that I will occasionally turn off Full Screen mode inadvertently by hitting the escape key on a page that doesn't intercept the escape key.

Is there a way to disable the "Escape turns off full screen mode" behavior in Safari?

3

4 Answers 4

4

Now, you could go ahead and brute-force disable the Escape key in Safari. But that'd defeat the purpose of still allowing Escape to work as a shortcut in the aforementioned places, which I'd rather avoid.

See here for an example to remap Escape to ⌥Escape with a Keyboard Maestro macro:

UPDATE #1: You can scope the rule to only apply when full screen. (REJOICE!)

3
  • I have an issue in that once this is implemented, I can't dismiss the find dialogue with escape. Not certain what alt - escape is triggering, but it seems to trigger predictive text...Disabling autocorrect does not help.
    – rapscalli
    Commented Oct 21, 2016 at 22:45
  • This stops ESC from exiting spotlight if spotlight is opened on top of safari
    – minseong
    Commented Sep 28, 2017 at 12:10
  • ^^ Using cmd-. instead of alt-esc worked to fix that problem
    – minseong
    Commented Sep 28, 2017 at 12:16
1

For macOS 12.3, Safari 15.4 and Tampermonkey 4.17.6162 ($2 in App Store), this script (based on https://superuser.com/a/388993/620906) works for most websites (and you can usually still use Esc to close modals!):

// ==UserScript==
// @name           Keep Full Screen
// @namespace     http://superuser.com/q/315949
// @description    Prevents Escape key from leaving full screen.
// @include      https://*
// @include      http://*
// ==/UserScript==

document.onkeydown = function (evt) {
    if (evt.keyCode == 27) evt.preventDefault();
}
0

Simply use the alternative escape sequence: CTRL-[. It works like a charm and does not exit the full screen.

4
  • What is this supposed to do? For me, nothing happens when i press this. Only in the shell (Terminal) I could "begin a sequence of non-printing characters", but that's not really related here.
    – max
    Commented Sep 11, 2016 at 14:21
  • Say you inserted some text into a text box, you're done and would like to scroll down. Pressing the alternate escape sequence allows you to exit insert mode and the arrows will let you navigate the website again, rather than moving the cursor.
    – Atcold
    Commented Sep 11, 2016 at 14:54
  • 1
    Hmm, I tried that on several sites now and I couldn't find it working anywhere. But anyways, this wouldn't map to the same key code as the actual Esc key, would it? I'd like to have the Esc key (or the replacement) still working for websites that bind functionality to that key (e.g. ones that open a light box, which can be closed again by pressing Esc).
    – max
    Commented Sep 11, 2016 at 15:06
  • That worked for me just fine on a Coursera class homework page. I thought it would have generalised just fine.
    – Atcold
    Commented Sep 11, 2016 at 15:08
0

Use the combination Cmd+Esc)

This allows the webpage to "Esc" whatever is selected (i.e.: the editing of cells in Google Sheets) without affecting the browser.

Works on Ventura 13.2 with Safari 16.3.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .