Closed teleclimber closed 5 years ago
@teleclimber
Good ideas!!
I'll implement this function.
Glad to hear you're interested in implementing this. However I am not sure that shift+left/right for Hue and ctrl+left/right for alpha is the way that offers the best UX.
Main reasons:
Anyways, just my two cents, but I think using standard keyboard actions is far easier on the user.
I'm testing some keyboard features, but it's hard to get it right now. I think we need to do more research on the UX side.
I found some facts while testing.
The colorpicker must have the focus unconditionally and be able to receive key events. When you click with a mouse click, the focus does not go out.
When changing the mode through the tab, only the mode will be cycled. Finally, there is no way to get the focus back to the colorpicker.
When keystrokes are input, all events are passed to the colorpicker event handler. So, when you use the key defined in the colorpicker in the input, it behaves unintentionally. For example, when you press the right arrow, the input is the cursor movement, but the colorpicker is the act of changing the main color. This will cause the color at the current input to change.
As you say, you need to know in advance what keystrokes are. This is the most realistic way to switch to Tab mode.
I made feature/keyboard branch.
https://github.com/easylogic/codemirror-colorpicker/tree/feature/keyboard
I am going to update continues about keyboard feature
https://store.jui.io/v2/view.php?id=58f8d68594976c182b7b23c7
This is a sample page.
Place your cursor on the code mirror and hit ctrl + K to open the colorpicker popup.
But I still have a lot of problems.
On a Mac Ctrl+arrow changes the desktop! So I think using Ctrl+arrow is not going to work.
I agree that doing this in a branch is a good idea.
@teleclimber
I also added a metakey check.
Now Ctrl + arrow is equals to Cmd + arrow
cmd + left is the "back" button in Chrome, Cmd + right is "forward in history".
Have a look at the dev tools keyboard shortcuts to see which ones are likely "safe"
https://developers.google.com/web/tools/chrome-devtools/shortcuts
CMD + > or CMD + <
How is this?
CMD + < opens settings in Chrome.
This is a losing battle IMO. I would use tab
key only to navigate to inputs within colorpicker (including sliders and the gradient). And only arrow keys to change the value, with maybe fine grain and coarse grained modifier keys modeled on what detools does.
That way no weird surprises, and easily discoverable for user.
The tab only specifies the data region and the remainder defines the value with an arrow.
The current focus area should be expressed a little differently.
Good!
@teleclimber
https://store.jui.io/v2/view.php?id=58f8d68594976c182b7b23c7
I am refactoring for keyboard features.
Tab key is change selection area. Arrow keys is change real value for selection area.
This is a sample move patterns.
The "HEX" mode works great if you have the outer wrapper focused, but if you focus the hex input, the movement and color selection is awkward.
Now that we can open with
Ctrl-K
it would be nice if the whole component could be usable with just the keyboard.I suggest:
tab
, it changes the mode and blurs the input :(Esc
andEnter
and use those to close dialog and return focus to CM.Thanks. :)