diff --git a/.changeset/flat-eagles-press.md b/.changeset/flat-eagles-press.md index 63e79f89d5e..3b9818ea6fd 100644 --- a/.changeset/flat-eagles-press.md +++ b/.changeset/flat-eagles-press.md @@ -2,4 +2,4 @@ '@shopify/polaris': minor --- -Added `useCopyToClipboard` hook for building copy actions matching common actions guidelines. Updated `Tooltip` to dismiss on child enter/space key interactions. +Added `useCopyToClipboard` hook for building copy actions matching common actions guidelines diff --git a/polaris-react/src/components/Button/Button.stories.tsx b/polaris-react/src/components/Button/Button.stories.tsx index 9718fc55030..b7d5b9097c0 100644 --- a/polaris-react/src/components/Button/Button.stories.tsx +++ b/polaris-react/src/components/Button/Button.stories.tsx @@ -854,6 +854,7 @@ export function CopyToClipboard() { hoverDelay={500} preferredPosition="above" content="Copy" + active={status === 'copied' ? false : undefined} > - , - ); - - findWrapperComponent(tooltip)!.trigger('onKeyUp', { - target: tooltip.find('button')!.domNode, - key: 'Enter', - }); - - expect(tooltip).toContainReactComponent(TooltipOverlay, { - active: false, - }); - }); - - it('closes itself when space is pressed on keyup of child elements', () => { - const tooltip = mountWithApp( - - - , - ); - - findWrapperComponent(tooltip)!.trigger('onKeyUp', { - target: tooltip.find('button')!.domNode, - key: ' ', - }); - - expect(tooltip).toContainReactComponent(TooltipOverlay, { - active: false, - }); - }); - it('does not call onOpen when initially activated', () => { const openSpy = jest.fn(); const tooltip = mountWithApp(