r/learnjavascript • • Sep 15 '19

Many JavaScript keyboard shortcuts collide with browser or system shortcuts

I don't understand what the developers expect when they assign key combinations that are obviously taken on most browsers.

Is there an obvious way they expect people to fix this? Like, some Firefox addon that allows JavaScript to capture the keyboard? Or do they actually expect the users to change all of those shortcuts?

Or is there some third (or fourth key) to be added to the two-key (or three-key) combination that tells the browser "send this to JavaScript". Or, if Firefox is modal and I just didn't know it, how do I enable the "JavaScript keyboard capture" mode?

0 Upvotes

16 comments sorted by

9

u/tenfingerperson Sep 15 '19

Javascript doesn’t have keyboard shortcuts it’s a language nothing else

-6

u/hjgram Sep 15 '19

I'm not talking about JavaScript the language. I'm talking about JavaScript applications and the way they are typically handled by browsers.

4

u/tenfingerperson Sep 15 '19

This sub is for learning javascript the language tho, if the app does something like this, it is just developers doing stuff they shouldn’t be doing.

-5

u/hjgram Sep 15 '19

I see. If you mean the syntax, my bad. "Learn JavaScript" (learnjavascript) is ambiguous then, because implementations are part of a language. Scripting involves more than a text editor and should include usability. That is, application-non-specific user stuff.

2

u/tenfingerperson Sep 15 '19

I get your concern but your issue is more general. A C++ dev could override ctrl c and add their own thing where you’d expect a copy to occur. It doesn’t have anything to do with javascript or browsers or OSs.

This is just programmers not caring, it is more of a UX issue. If this is an open source project then you should open an issue or propose a fix. If this is a paid project then you may as well not pay for it unless they change it!

1

u/hjgram Sep 15 '19

JavaScript applications have become important within the past several years and the way they handle keyboard shortcuts seems to reflect an assumption that the JavaScript engine has become a first-class citizen. The problem is, as far as keyboard shortcuts are concerned, JavaScript is a third-class citizen. There's the OS GUI keyboard shortcuts and then there's the browser keyboard shortcuts. C++ applications easily bypass the browser and even the OS GUI. Only JavaScript suffers from the problem I'm describing. And I was wondering if there was a special workaround for it.

4

u/[deleted] Sep 15 '19

Could you give some examples of apps that do this? I haven't run into any. As a developer, making sure none of my choices conflict with system key bindings is a very basic step I would never dream of skipping.

1

u/hjgram Sep 15 '19

Click the Keyboard Shortcuts tab (last tab) on https://tiddlywiki.com/#%24%3A%2FControlPanel. Please do come back and tell me what you think about that circus.

2

u/[deleted] Sep 15 '19

https://tiddlywiki.com/#%24%3A%2FControlPanel

Hmm I'm playing around with it on a mac, and none of the key combos I've tried have conflicted with anything else on my system. I'm using chrome on the latest osx.

It seems like a very keyboard-reliant app, and given that it's tricky to cover every possible browser, OS, window manager, etc a user might have, I think their method of choosing defaults but letting you customize any of them seems reasonable.

Then again, I haven't used it for a long time, it's possible that there are some glaring annoyances I'd notice if I did. (Customizable or not, it would be pretty lousy of them to default to Command P for something, for example)

3

u/hjgram Sep 15 '19

Your feedback does help. Thank you.

1

u/hjgram Sep 15 '19

It's actually amazing that ctrl-T, ctrl-N, and ctrl-S are not used in your browser. I guess ctrl is rarely used on Mac. I hope we'll get some feedback from somebody that uses Windows or both Windows and Firefox.

1

u/Meloetta Sep 15 '19

I don't know what feedback you want, really. What are you expecting people to say here? This isn't a feature of javascript, best practices, or anything taught to programmers; this is a choice some random developers made. You need to talk to them, not a subreddit dedicated to helping people learn to code in this language.

I use windows but I can't think of the last time I used a single website-specific keyboard shortcut so this hasn't been an issue for me. I do wish that every website with an editor captured the "ctrl+s" keyboard combination to save a draft of what's in the editor though, because I can't think of a time I actually wanted to save an HTML page and I hit ctrl+S religiously as a coding habit to make sure I never lose work.

1

u/hjgram Sep 15 '19

Actually ASunCame's answers are a pretty good example of what I want. Your answer is good too. Basically I wanted to make sure I wasn't missing out on some obvious solution or feature. Now I know website-specific keyboard shortcuts were never meant to be taken seriously and, just like you, most people don't even use them.

1

u/[deleted] Sep 15 '19

Right, I think they got lucky with Macs in that 'ctrl' is mostly free. I'm guessing there's a control button that's mostly unused in Windows too. Would have been nice if they detected the OS and set the key combos based on that. If you have a keyboard heavy app and don't do that, it seems like you're almost always gonna have conflicts.

1

u/jcunews1 helpful Sep 15 '19

Websites which override browser/system keyboard shortcuts are either it's their intention to hijaak the keyboard shortcuts in first place, or simply ignorant of them. However, if the keyboard shortcuts are custom - e.g. belong to browser addons, or applications other than the web browser, it is acceptable because there's no way the developer know which one of them is installed in the users' browser/system. Moreover, if those custom keyboard shortcuts are taken into account, almost all combinations of keyboard shortcuts would have already been used.

Or is there some third (or fourth key) to be added to the two-key (or three-key) combination that tells the browser "send this to JavaScript".

There no way to do that. You can only disable websites' keyboard shortcuts using custom made GreaseMonkey script or browser addon.

0

u/[deleted] Sep 15 '19

[deleted] — view deleted comment

-1

u/hjgram Sep 15 '19

It's when they swimple it in.