-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Canvas] Adds doc links and keyboard shortcut cheatsheat to help menu #31335
Conversation
Pinging @elastic/kibana-canvas |
💚 Build Succeeded |
@@ -80,7 +80,7 @@ export const WorkpadHeader = ({ | |||
<EuiFlexItem grow={false}> | |||
<FullscreenControl> | |||
{({ toggleFullscreen }) => ( | |||
<EuiToolTip position="bottom" content="Toggle fullscreen mode"> | |||
<EuiToolTip position="bottom" content="Enter fullscreen mode"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
withHandlers(({ commit }) => ({ | ||
groupElements: () => | ||
commit('actionEvent', { | ||
event: 'group', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
}, | ||
GROUP: { | ||
osx: ['g'], | ||
windows: ['g'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it need 'G' and 'U' too?
osx: ['u'], | ||
windows: ['u'], | ||
linux: ['u'], | ||
other: ['u'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If all platforms have the same key, would a single line of other
cover it as a fallback, or is there some other defaulting? I'm not saying enlisting it is not nice, eg. for code documentation purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like react-shortcuts handles both cases. Both lowercase and uppercase keys (i.e with caps lock on) trigger the shortcuts.
Note: this was a response meant for the comment above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If all platforms have the same key, would a single line of
other
cover it as a fallback, or is there some other defaulting? I'm not saying enlisting it is not nice, eg. for code documentation purpose.
I needed the objects to be a specific shape. A single line would've worked too, but I wanted the shortcut to with the shape
{
help: 'description',
osx: ['shortcut'],
windows: ['shortcut'],
linux: ['shortcut'],
other: ['shortcut'],
}
because I needed the shortcut to be an object that I could add a help
attribute to that is compatible with what react-shortcuts
expects as a valid keymap.
const handleKeyPress = (commit, e, isEditable) => { | ||
const { key, target } = e; | ||
const upcaseKey = key && key.toUpperCase(); | ||
if (isEditable && !isTextInput(target) && 'GU'.indexOf(upcaseKey) !== -1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see isTextInput
is disused, is it the case that the new handler already isn't active when the input target is a text input tag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested typing in an advanced filter and it appears that the handler doesn't correctly handle the event target being an input control. I'll add the check to the key handler.
return false; | ||
} | ||
}; | ||
|
||
const modifierKey = key => ['KeyALT', 'KeyCONTROL'].indexOf(keyCode(key)) > -1; | ||
|
||
const handleKeyDown = (commit, e, isEditable) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't cleaned up some code here because the expectation was that, we're going to add back the initially present layout keyboard shortcuts for moving/rotating/resizing elements, which were initially fully handled in aero. Since we decided that keystrokes should be none of aero's concern, I recently removed the processing code, and I think this handleKeyDown
is no longer doing anything useful so could be removed. May be extra safe to search for keyboardEvent
under aeroelastic/
. A bit tangential to your PR but you're reworking a good bunch of key handling so removing this vestige may free you up for whatever this may have blocked (or just remove a few lines).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked, and there aren't any instances of keyboardEvent
in the aeroelastic code. I'll go ahead and remove the key event handlers
With so many nicely documented shortcuts by now, a context menu will be very useful too :-) |
5f39b82
to
df70bfc
Compare
💔 Build Failed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome, very helpful!
I had some typography and copy changes that I've put into a PR: cqliu1#1
Once those are in, then I'll be 👍 , Thanks!
💔 Build Failed |
Great work @cqliu1! Some feedback below. The docs button text looks much larger in comparison to the rest of Canvas. Is this specific to EUI? Maybe @ryankeairns typography changes addressed this. I'm guessing so, but are the commands conditional based on OS? I still see the docs link in the list view. Was the removal of that link meant to be part of this PR as well? As this feature was snuck in so fast, I'm not sure what the expectations are. Are we meant to continually link out to general Kibana docs. I'd imagine so, I think it's helpful. That being said, i the primary action always meant to be the in context documentation? Would love to hear @cchaos & @ryankeairns thoughts here. FWIW I think the screenshot below makes sense, just want to make sure we're consistent with other implementations. |
The original PR for this support menu demonstrated plain text links, however the component was designed to accept whatever content is supplied. In talking with Catherine, the global nature/placement of the support button may not feel like a logical place to find Canvas docs so we discussed emphasizing our links visually - thus the buttons. It's tough, we may be setting an undesirable precedent using buttons here, but then the links feel visually insufficient on their own. For that reason, I was ok with the buttons, but perhaps a better design solution is needed in the near future. |
@ryankeairns , The top section of the help popover is actually optional (on by default). You can opt to remove it by setting kibana/src/legacy/ui/public/chrome/directives/header_global_nav/components/header_help_menu.tsx Line 51 in 8aada89
|
f417d5c
to
16813e0
Compare
💔 Build Failed |
💔 Build Failed |
💚 Build Succeeded |
💚 Build Succeeded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fix: reintroduce additional call on keyboard event
💚 Build Succeeded |
…elastic#31335) * Added docs link and keyboard shortcuts to global help menu * Fixed tooltip * Removed aeroelastic keyboard event handlers * typography and copy changes * Removed doc links from workpad manager * Added input target check to workpad page keyhandler * Fixed ungrouping * Displays arrow symbols instead of arrow key word * Removed tabIndex * Fix: reintroduce additional call on keyboard event
…elastic#31335) * Added docs link and keyboard shortcuts to global help menu * Fixed tooltip * Removed aeroelastic keyboard event handlers * typography and copy changes * Removed doc links from workpad manager * Added input target check to workpad page keyhandler * Fixed ungrouping * Displays arrow symbols instead of arrow key word * Removed tabIndex * Fix: reintroduce additional call on keyboard event
…elastic#31335) * Added docs link and keyboard shortcuts to global help menu * Fixed tooltip * Removed aeroelastic keyboard event handlers * typography and copy changes * Removed doc links from workpad manager * Added input target check to workpad page keyhandler * Fixed ungrouping * Displays arrow symbols instead of arrow key word * Removed tabIndex * Fix: reintroduce additional call on keyboard event
…#31335) (#31728) * Added docs link and keyboard shortcuts to global help menu * Fixed tooltip * Removed aeroelastic keyboard event handlers * typography and copy changes * Removed doc links from workpad manager * Added input target check to workpad page keyhandler * Fixed ungrouping * Displays arrow symbols instead of arrow key word * Removed tabIndex * Fix: reintroduce additional call on keyboard event
…#31335) (#31727) * Added docs link and keyboard shortcuts to global help menu * Fixed tooltip * Removed aeroelastic keyboard event handlers * typography and copy changes * Removed doc links from workpad manager * Added input target check to workpad page keyhandler * Fixed ungrouping * Displays arrow symbols instead of arrow key word * Removed tabIndex * Fix: reintroduce additional call on keyboard event
…elastic#31335) * Added docs link and keyboard shortcuts to global help menu * Fixed tooltip * Removed aeroelastic keyboard event handlers * typography and copy changes * Removed doc links from workpad manager * Added input target check to workpad page keyhandler * Fixed ungrouping * Displays arrow symbols instead of arrow key word * Removed tabIndex * Fix: reintroduce additional call on keyboard event
…elastic#31335) * Fixed tooltip in fullscreen_control * Removed aeroelastic keyboard event handlers * Added input target check to workpad page keyhandler * Fixed ungrouping * Removed tabIndex * Fix: reintroduce additional call on keyboard event
Closes #31266.
Closes #29657.
This moves doc links from the workpad loader to the global nav. This also adds a keyboard shortcut cheatsheet. These shortcuts are dynamically generated from
.../lib/keymap.js
and displays the shortcuts corresponding to the client OS.Global Nav Help Menu
Mac Shortcuts
Windows Shortcuts (same shortcuts for Linux and any other OS)
I'll add more shortcuts available in the layout engine in a future PR.