From 5ce1ff0e1e56cc19194892b791bb63edb24d1b0c Mon Sep 17 00:00:00 2001 From: Aaron Casanova Date: Thu, 28 Mar 2024 10:17:00 -0700 Subject: [PATCH 1/2] Revert Tooltip updates to close on enter/space key interactions --- .../src/components/Button/Button.stories.tsx | 1 + .../src/components/Tooltip/Tooltip.tsx | 18 ++--- .../components/Tooltip/tests/Tooltip.test.tsx | 68 ------------------- 3 files changed, 5 insertions(+), 82 deletions(-) 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( From 07b2fa2e3bb987eb8271a6cad0dedd3285c16186 Mon Sep 17 00:00:00 2001 From: Aaron Casanova Date: Thu, 28 Mar 2024 10:24:54 -0700 Subject: [PATCH 2/2] Update changeset entry --- .changeset/flat-eagles-press.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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