User tests: Successful: Unsuccessful:
This is a proof of concept for a new plugin offering keyboard shortcuts in the Joomla admin based on previous work by @jneubauer
For testing I have created the following shortcut keys
Save - Alt/Opt S
Save & Close - Shift + Alt/Opt S
Save & New - Shift + Alt/Opt N
Save as Copy - Shift + Alt/Opt C
Cancel/Close - Alt/Opt X
New - Alt/Opt N
Help - Alt/Opt H
Options - Alt/Opt
Alt/Opt means Alt key on Windows/Linux and Option key on Mac
When testing please report the operating system, browser, language AND keyboard layout/lang
Status | New | ⇒ | Pending |
Category | ⇒ | Repository JavaScript NPM Change Front End Plugins |
Labels |
Added:
NPM Resource Changed
?
|
Category | Repository JavaScript NPM Change Front End Plugins | ⇒ | Administration Language & Strings Repository JavaScript NPM Change Front End Plugins |
Labels |
Added:
?
|
As I said - by default NONE of these shortcuts work when the cursor is in a text area. Its just a config option to enable if desired
@brianteeman also you don't need an extra script, just add the logic in the toolbar.js
mousetrap is much better
mousetrap is much better
I always prefer less code and of course no dependencies, but that's me...
I prefer maintainable code with no bus factor
I prefer maintainable code with no bus factor
Just because you're pulling something from NPM is not automagically more maintainable or has a greater bus factor...
Is a great and welcome feature!
Just to make my self clear here, when I said
also you don't need an extra script, just add the logic in the toolbar.js
I meant the build/media_source/plg_system_shortcuts/js/shortcuts.js
not the mousetrap.js.
So all your code in the shortcuts.js
can happily live in the toolbar, actually it'e exactly the place it belongs
Ah. I misunderstood you there.
As it's a proof of concept it's better on its own. If accepted it can be moved into that file of course
Also it depends if people want it to be configurable by the user (or even disabled) or not. And anyway toolbar is probably not the best place as even in this example there are some that work on pages without a toolbar
@brianteeman it can still be configurable, also by reading the code this works only with the toolbar buttons.
Also by reviewing the code of mousetrap.js I would say it's an overkill and probably not good fit for J4, reason the script is mainly polyfilling IE 6,7,8,9 which none is supported by J4
From the point of view of a11y, this is extremely important and necessary functionality.
I miss the general toolbar shortcut key (of course, I remember that there will be quick access via SkipTo). My suggestion - instead of a shortcut Return to Control panel let the shortcut to the toolbar.
As to combination "j h" - I will ask my friend (blind accessibility expert) for their opinion.
The keys I used are just examples
Great idea. Does this also include a hint list in the actual admin panel?
Not yet. But it's supported by mousetrap
Category | Repository JavaScript NPM Change Front End Plugins Administration Language & Strings | ⇒ | Administration Front End JavaScript Language & Strings Plugins Repository |
Title |
|
Title |
|
Category | Repository JavaScript Front End Plugins Administration Language & Strings | ⇒ | Administration Language & Strings Repository JavaScript NPM Change Front End Plugins |
Category | Repository JavaScript Front End Plugins Administration Language & Strings NPM Change | ⇒ | Administration Front End JavaScript Language & Strings Plugins Repository |
Category | Repository JavaScript Front End Plugins Administration Language & Strings | ⇒ | Administration Front End JavaScript Plugins Repository |
I will ask my friend (blind accessibility expert) for their opinion.
Did you get any feedback?
@brianteeman: I'm sory. Give me two days. I forgot.
This is the opinion of my blind friend (the accessibility tester):
The idea is OK and nothing should bite, but the semantically suggested shortcuts, at least in my opinion, are not associated with the actions they perform.
Rather, I saw digitally-based shortcuts used to switch between page areas, bookmarks, etc. I've seen them.
I don't know if any browser uses them to quickly select predefined bookmarks.
I would suggest shortcuts based on letters such as Ctrl+Shift+S - saves, Ctrl+Shift+X - output, etc.
If necessary, I recommend to be inspired by Google documents or Wordpress.
(I checked - there are no shortcuts of this kind in Wordpress.)
If I remember correctly any shortcuts setup by the browser itself will override any shortcuts we set so we have to be careful about the keys being used
That's why I was testing if "j h" technically worked as a combination.
And I have no idea at all how this type of thing is handled in languages with non-latin keyboards
In this case I think we should not use the library you are proposing. the benefit in this specific case is minimal.
For example the mod key is simply an alias for /Mac|iPod|iPhone|iPad/.test(navigator.platform) ? 'meta' : 'ctrl'
(https://github.com/ccampbell/mousetrap/blob/master/mousetrap.js#L135) which isn't hard for us to port. And in this case I agree with @dgrammatiko that a library to effectively 1 modifier isn't much use for us.
However I of course approve the concept. I can help with converting these to native JS if you would lik help. It really shouldn't be more than 30 minutes work.
I will put it on my todo list
My blind friend has also drawn my attention to a very important issue. We must bear in mind the: Success Criterion 2.1.4 Character Key Shortcuts
Because this is a plugin it can be disabled as any other plugin therefore we meet that criteria under "mechanism to disable". If we wanted to be really fancy in the future we could even investigate the ability to change the shortcuts as part of the plugin. But for now just disabling which we already have is the MVP to meet such compliance
Also none of these things Brian has done are only using only letter (including upper- and lower-case letters), punctuation, number, or symbol characters.
. They all start with the modifier key (control on windows or the command key on mac)
So we're safe on multiple levels
Exactly!!
No need to comment on code style as this is NOT the code we will use. It
was just to test the concepts
On Fri, 17 May 2019, 17:41 Quy, notifications@github.com wrote:
@Quy commented on this pull request.
In plugins/system/shortcuts/shortcuts.php
#24152 (comment):
}
}
catch (Exception $exc)
{
$current_section = 0;
}
if (!($current_section & $section))
{
return false;
}
{
HTMLHelper::_('script', 'vendor/mousetrap/mousetrap.js', ['version' => 'auto', 'relative' => true], ['defer' => true]);
HTMLHelper::_('script', 'plg_system_shortcuts/shortcuts.js', array('version' => 'auto', 'relative' => true), ['defer' => true]);
}
Delete?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/joomla/joomla-cms/pull/24152?email_source=notifications&email_token=AAJ4P4P5T5HW6A66W56LSQ3PV3GYVA5CNFSM4G45UB4KYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOBY7M76A#pullrequestreview-238997496,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJ4P4MGDAXIX2XCJBJ4XITPV3GYVANCNFSM4G45UB4A
.
Labels |
Removed:
J4 Issue
|
Category | Repository JavaScript Front End Plugins Administration | ⇒ | Administration Language & Strings JavaScript Repository NPM Change Front End Plugins |
Labels |
Added:
?
|
Title |
|
Title |
|
This should now be in native js and not use any external libraries. I have updated the original description.
Sorry @dgrammatiko @wilsonge you were right - it didnt need the library at all
Labels |
Removed:
?
|
Updating branch to trigger drone
This works. However altKey
either doesn't trigger or is overriden by browser behavior in chrome on my mac. option x still cuts, option s still downloads the web page, option h goes to the home page in chrome. all the commands are usable if using the actual alt
key instead of the option key.
The docs say that alt on windows and opt on mac are triggered by altKey
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/altKey
Can you go to https://keycode.info/ and tell me the results you get for alt and opt on your mac
I can only think then that the mdn documentation I linked to is incorrect and they keystrokes are ALT on both and OSx
Trying to figure it out tbh. Like the docs says the option key. that seems different to the command key. And the symbol is the one I have on my alt key.
I think the meta key is correct on macs https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/metaKey
However saying that we start to override a bunch of browser short codes (nearly all the combinations you have are already native browser combinations)
Using the meta key really isn't an option
Tested by placing cursor in Title field and pressing Alt + S. Got the same screenshot for Alt.
It is SHIFT and Alt
Same result.
might be a firefox bug - will investigate
In Edge, Shift + Alt + S
result in Save, not Save & Close. Alt + X
results in browser's Settings and More
menu being opened. Alt + O
doesn't do anything.
Windows 10, US layout.
I can confirm that the keyboard shortcuts I chose clash with some of the native browser shortcuts in firefox - grrh
I am closing this. It really serves little value especially regarding accessibility
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-01-19 15:20:58 |
Closed_By | ⇒ | brianteeman |
fwiw the
ctrl+s
was already implemented (but George manage to undo that) here: joomla/40-backend-template#55Also it worth copying the tinyMCE bits from there, so the combo works also when the cursor is in the editors iframe