From 5be0ff4e89cee4e6a1e13e1e3c073bf13d7b8c9b Mon Sep 17 00:00:00 2001 From: iseulde Date: Sat, 5 May 2018 14:52:35 +0200 Subject: [PATCH 1/6] Add shortcut tooltips for main toolbar --- components/icon-button/index.js | 17 ++++++++++++----- editor/components/editor-history/redo.js | 6 ++++++ editor/components/editor-history/undo.js | 6 ++++++ editor/components/post-saved-state/index.js | 2 ++ 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/components/icon-button/index.js b/components/icon-button/index.js index 34a9a820b89f1..ad7c0ab268f79 100644 --- a/components/icon-button/index.js +++ b/components/icon-button/index.js @@ -25,14 +25,21 @@ class IconButton extends Component { const classes = classnames( 'components-icon-button', className ); const tooltipText = tooltip || label; - // Should show the tooltip if an explicit tooltip is passed - // or if there's a label and the children are empty and the tooltip is not explicitely disabled - const showTooltip = !! tooltip || + // Should show the tooltip... + const showTooltip = ( + // if an explicit tooltip is passed or... + !! tooltip || + // if there's a shortcut or... + !! shortcut || ( - label && + // if there's a label and... + !! label && + // the children are empty and... ( ! children || ( isArray( children ) && ! children.length ) ) && + // the tooltip is not explicitely disabled. false !== tooltip - ); + ) + ); let element = (