getkirby-v2 / panel

This is the deprecated admin panel for Kirby v2.
http://getkirby.com
Other
134 stars 70 forks source link

Don't override the refresh key (F5) on Windows #856

Closed jenstornell closed 3 years ago

jenstornell commented 8 years ago

... Could we please change the keyboard shortcut away from "F5"? "F5" in Windows is like "Cmd + R" on mac (refresh page). I think overriding the refresh key (with something that doesn't refresh the page) isn't that user friendly

More here:

https://forum.getkirby.com/t/changing-templates-in-panel-super-nice-but/4281

rasteiner commented 8 years ago

Oh, now that I know that it's a bug and not intended behaviour, here's something I've noticed: It seems to happen only when no form element (a textbox, textarea, select, etc) is selected.

jenstornell commented 8 years ago

@rasteiner It also only happends when the "template switcher" is available.

rasteiner commented 8 years ago

It's interesting to know that the "keyCode" for F5 is 116, but "charCode 116" in ascii is "t" (lowercase T). Don't know if there was meant to be a short cut with "t" for the template changer.

See here what happens when I press F5: image (event.which and event.keyCode are both 116)

lukasbestle commented 8 years ago

Thank you very much for the details, @rasteiner! After quite some time of tracking this down I found out that this is a bug in the jQuery hotkeys plugin:

We can't fix this directly in Kirby, but we will need to look for a new hotkey library. @bastianallgeier?

jenstornell commented 8 years ago

Do you really need a library for that? I did not need it in Splitview.

https://github.com/jenstornell/splitview/blob/master/assets/js/src/site/site.js#L51

lukasbestle commented 8 years ago

I did not say "framework", just "library". :) A library for this is useful because it knows about special key codes like the F keys, backspace, escape etc.

BTW: Your code seems to have the same problem with the ASCII key codes. ;)

manuelmoreale commented 8 years ago

I'll leave a few suggestions for possible alternatives to the hotkeys plugin. Since I know @bastianallgeier loves to be a "purist" of the web (and so do I) the following are pure js libraries, no jQuery involved.

Not sure if these are 100% what you guys are looking for but maybe I'll save you a few searches.

chpio commented 5 years ago

any progress on this one?

lukasbestle commented 5 years ago

Sorry for the delay! We haven't been able to fix this in Kirby 2, but as far as I can tell, Kirby 3 (which will be out soon) won't have this issue. :)