Skip to content
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

Merged
merged 11 commits into from
Feb 21, 2019

Conversation

cqliu1
Copy link
Contributor

@cqliu1 cqliu1 commented Feb 16, 2019

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

screen shot 2019-02-15 at 5 16 19 pm

Mac Shortcuts

screen shot 2019-02-15 at 3 39 22 pm

Windows Shortcuts (same shortcuts for Linux and any other OS)

screen shot 2019-02-15 at 4 56 11 pm

I'll add more shortcuts available in the layout engine in a future PR.

@cqliu1 cqliu1 added review v7.0.0 Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v8.0.0 v6.7.0 v7.2.0 labels Feb 16, 2019
@cqliu1 cqliu1 requested a review from a team as a code owner February 16, 2019 00:24
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-canvas

@elasticmachine
Copy link
Contributor

💚 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">
Copy link
Contributor

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',
Copy link
Contributor

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'],
Copy link
Contributor

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'],
Copy link
Contributor

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.

Copy link
Contributor Author

@cqliu1 cqliu1 Feb 20, 2019

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

Copy link
Contributor Author

@cqliu1 cqliu1 Feb 21, 2019

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) {
Copy link
Contributor

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?

Copy link
Contributor Author

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) => {
Copy link
Contributor

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).

Copy link
Contributor Author

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

@monfera
Copy link
Contributor

monfera commented Feb 16, 2019

With so many nicely documented shortcuts by now, a context menu will be very useful too :-)

@elasticmachine
Copy link
Contributor

💔 Build Failed

Copy link
Contributor

@ryankeairns ryankeairns left a 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!

@elasticmachine
Copy link
Contributor

💔 Build Failed

@alexfrancoeur
Copy link

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.

image

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?

image

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.

image

@ryankeairns
Copy link
Contributor

@alexfrancoeur @cqliu1

  • The font size in the support menu is set globally, outside of Canvas. We're opting to use a smaller font size in the Canvas "chrome", thus the difference.
  • We should remove that 'Docs' link from the workpad loader.
  • The way the support menu works is that the top section (including the 'Go to documentation' button) is baked in for everybody. Plugin developers determine what appears below that section which in this case is the Canvas specific text and two buttons.

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.

@cchaos
Copy link
Contributor

cchaos commented Feb 20, 2019

@ryankeairns , The top section of the help popover is actually optional (on by default). You can opt to remove it by setting useDefaultContent = false

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@cqliu1
Copy link
Contributor Author

cqliu1 commented Feb 20, 2019

I added one minor change. I changed the arrow keys to arrow symbols in the cheatsheet.
screen shot 2019-02-20 at 12 32 04 pm

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link

@alexfrancoeur alexfrancoeur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@cqliu1 cqliu1 merged commit 0ad6345 into elastic:master Feb 21, 2019
@cqliu1 cqliu1 deleted the canvas/help-menu branch February 21, 2019 18:56
cqliu1 added a commit to cqliu1/kibana that referenced this pull request Feb 21, 2019
…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
cqliu1 added a commit to cqliu1/kibana that referenced this pull request Feb 21, 2019
…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
cqliu1 added a commit to cqliu1/kibana that referenced this pull request Feb 21, 2019
…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
cqliu1 added a commit that referenced this pull request Feb 21, 2019
…#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
cqliu1 added a commit that referenced this pull request Feb 21, 2019
…#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
@cqliu1 cqliu1 removed the v6.7.0 label Feb 21, 2019
monfera pushed a commit to monfera/kibana that referenced this pull request Feb 22, 2019
…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
cqliu1 added a commit to cqliu1/kibana that referenced this pull request Feb 22, 2019
…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
cqliu1 added a commit that referenced this pull request Feb 22, 2019
…#31335) (#31729)

* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants