Skip to content

Commit

Permalink
Apply show tooltip fix to the Site editor Save button.
Browse files Browse the repository at this point in the history
  • Loading branch information
afercia committed Oct 31, 2022
1 parent b439cc7 commit dbc9d3a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/edit-site/src/components/save-button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,18 @@ export default function SaveButton() {
isBusy={ isSaving }
onClick={ disabled ? undefined : () => setIsSaveViewOpened( true ) }
label={ label }
/*
* We want the tooltip to show the keyboard shortcut only when the
* button does something, i.e. when it's not disabled.
*/
shortcut={ disabled ? undefined : displayShortcut.primary( 's' ) }
/*
* Displaying the keyboard shortcut conditionally makes the tooltip
* itself show conditionally. This would trigger a full-rerendering
* of the button that we want to avoid. By setting `showTooltip`,
& the tooltip is always rendered even when there's no keyboard shortcut.
*/
showTooltip
>
{ label }
</Button>
Expand Down

0 comments on commit dbc9d3a

Please sign in to comment.