From 0c57a1f9b8895fc01effc96fc9bea7fb898688ea Mon Sep 17 00:00:00 2001 From: Rohan Kadkol <45748283+rohan-kadkol@users.noreply.github.com> Date: Tue, 26 Mar 2024 11:35:13 -0400 Subject: [PATCH 1/6] Tooltips don't keep being displayed upon hovering out after a click (#1944) --- .changeset/famous-hats-shout.md | 7 +++++++ packages/itwinui-react/src/core/Tooltip/Tooltip.tsx | 8 +++++--- 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 .changeset/famous-hats-shout.md diff --git a/.changeset/famous-hats-shout.md b/.changeset/famous-hats-shout.md new file mode 100644 index 00000000000..6f4dcc26434 --- /dev/null +++ b/.changeset/famous-hats-shout.md @@ -0,0 +1,7 @@ +--- +"@itwin/itwinui-react": patch +--- + +Fixed an issue where `Tooltip` would stay open after clicking on the trigger element. The tooltip will now be correctly dismissed upon click. + +Also affects other components that use tooltips internally: `IconButton`, `SideNavigation`, etc. diff --git a/packages/itwinui-react/src/core/Tooltip/Tooltip.tsx b/packages/itwinui-react/src/core/Tooltip/Tooltip.tsx index 84407fdec71..a545ef1f606 100644 --- a/packages/itwinui-react/src/core/Tooltip/Tooltip.tsx +++ b/packages/itwinui-react/src/core/Tooltip/Tooltip.tsx @@ -10,7 +10,6 @@ import { offset, flip, shift, - useClick, useHover, useFocus, useDismiss, @@ -173,10 +172,13 @@ const useTooltip = (options: TooltipOptions = {}) => { useHover(floating.context, { delay: delay ?? { open: 50, close: 250 }, handleClose: safePolygon({ buffer: -Infinity }), + move: false, }), useFocus(floating.context), - useClick(floating.context), - useDismiss(floating.context), + useDismiss(floating.context, { + referencePress: true, + referencePressEvent: 'click', + }), ]); // Manually add attributes and event handlers to external reference element, From e3bdda14a320540036ee04a706c1b4d19783df03 Mon Sep 17 00:00:00 2001 From: Mayank <9084735+mayank99@users.noreply.github.com> Date: Tue, 26 Mar 2024 11:37:27 -0400 Subject: [PATCH 2/6] bump `express` to `4.19.2` (#1952) --- pnpm-lock.yaml | 88 ++++++-------------------------------------------- 1 file changed, 10 insertions(+), 78 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d7fef4d6de6..156a79966c4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3712,7 +3712,7 @@ packages: esbuild-plugins-node-modules-polyfill: 1.6.3(esbuild@0.17.6) execa: 5.1.1 exit-hook: 2.2.1 - express: 4.18.2 + express: 4.19.2 fs-extra: 10.1.0 get-port: 5.1.1 gunzip-maybe: 1.4.2 @@ -3756,7 +3756,7 @@ packages: - utf-8-validate dev: true - /@remix-run/express@2.8.0(express@4.18.2)(typescript@5.1.6): + /@remix-run/express@2.8.0(express@4.19.2)(typescript@5.1.6): resolution: {integrity: sha512-15qnPt+vrvv66pvdcRiodNF5I5Rot07HoKjVlrXYSO4KbSg9WTE0jCPX0rFStD4QNTa2hIl8YftPlmZXjFxQoQ==} engines: {node: '>=18.0.0'} peerDependencies: @@ -3767,7 +3767,7 @@ packages: optional: true dependencies: '@remix-run/node': 2.8.0(typescript@5.1.6) - express: 4.18.2 + express: 4.19.2 typescript: 5.1.6 /@remix-run/node@2.8.0(typescript@5.1.6): @@ -3818,11 +3818,11 @@ packages: engines: {node: '>=18.0.0'} hasBin: true dependencies: - '@remix-run/express': 2.8.0(express@4.18.2)(typescript@5.1.6) + '@remix-run/express': 2.8.0(express@4.19.2)(typescript@5.1.6) '@remix-run/node': 2.8.0(typescript@5.1.6) chokidar: 3.6.0 compression: 1.7.4 - express: 4.18.2 + express: 4.19.2 get-port: 5.1.1 morgan: 1.10.0 source-map-support: 0.5.21 @@ -5393,25 +5393,6 @@ packages: /bluebird@3.7.2: resolution: {integrity: sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==} - /body-parser@1.20.1: - resolution: {integrity: sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==} - engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16} - dependencies: - bytes: 3.1.2 - content-type: 1.0.5 - debug: 2.6.9 - depd: 2.0.0 - destroy: 1.2.0 - http-errors: 2.0.0 - iconv-lite: 0.4.24 - on-finished: 2.4.1 - qs: 6.11.0 - raw-body: 2.5.1 - type-is: 1.6.18 - unpipe: 1.0.0 - transitivePeerDependencies: - - supports-color - /body-parser@1.20.2: resolution: {integrity: sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==} engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16} @@ -5430,7 +5411,6 @@ packages: unpipe: 1.0.0 transitivePeerDependencies: - supports-color - dev: true /boolbase@1.0.0: resolution: {integrity: sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==} @@ -6120,6 +6100,7 @@ packages: /cookie@0.5.0: resolution: {integrity: sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==} engines: {node: '>= 0.6'} + dev: true /cookie@0.6.0: resolution: {integrity: sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==} @@ -7516,46 +7497,8 @@ packages: requiresBuild: true optional: true - /express@4.18.2: - resolution: {integrity: sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==} - engines: {node: '>= 0.10.0'} - dependencies: - accepts: 1.3.8 - array-flatten: 1.1.1 - body-parser: 1.20.1 - content-disposition: 0.5.4 - content-type: 1.0.5 - cookie: 0.5.0 - cookie-signature: 1.0.6 - debug: 2.6.9 - depd: 2.0.0 - encodeurl: 1.0.2 - escape-html: 1.0.3 - etag: 1.8.1 - finalhandler: 1.2.0 - fresh: 0.5.2 - http-errors: 2.0.0 - merge-descriptors: 1.0.1 - methods: 1.1.2 - on-finished: 2.4.1 - parseurl: 1.3.3 - path-to-regexp: 0.1.7 - proxy-addr: 2.0.7 - qs: 6.11.0 - range-parser: 1.2.1 - safe-buffer: 5.2.1 - send: 0.18.0 - serve-static: 1.15.0 - setprototypeof: 1.2.0 - statuses: 2.0.1 - type-is: 1.6.18 - utils-merge: 1.0.1 - vary: 1.1.2 - transitivePeerDependencies: - - supports-color - - /express@4.18.3: - resolution: {integrity: sha512-6VyCijWQ+9O7WuVMTRBTl+cjNNIzD5cY5mQ1WM8r/LEkI2u8EYpOotESNwzNlyCn3g+dmjKYI6BmNneSr/FSRw==} + /express@4.19.2: + resolution: {integrity: sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==} engines: {node: '>= 0.10.0'} dependencies: accepts: 1.3.8 @@ -7563,7 +7506,7 @@ packages: body-parser: 1.20.2 content-disposition: 0.5.4 content-type: 1.0.5 - cookie: 0.5.0 + cookie: 0.6.0 cookie-signature: 1.0.6 debug: 2.6.9 depd: 2.0.0 @@ -7591,7 +7534,6 @@ packages: vary: 1.1.2 transitivePeerDependencies: - supports-color - dev: true /expressive-code@0.33.5: resolution: {integrity: sha512-UPg2jSvZEfXPiCa4MKtMoMQ5Hwiv7In5/LSCa/ukhjzZqPO48iVsCcEBgXWEUmEAQ02P0z00/xFfBmVnUKH+Zw==} @@ -12673,15 +12615,6 @@ packages: resolution: {integrity: sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==} engines: {node: '>= 0.6'} - /raw-body@2.5.1: - resolution: {integrity: sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==} - engines: {node: '>= 0.8'} - dependencies: - bytes: 3.1.2 - http-errors: 2.0.0 - iconv-lite: 0.4.24 - unpipe: 1.0.0 - /raw-body@2.5.2: resolution: {integrity: sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==} engines: {node: '>= 0.8'} @@ -12690,7 +12623,6 @@ packages: http-errors: 2.0.0 iconv-lite: 0.4.24 unpipe: 1.0.0 - dev: true /rc@1.2.8: resolution: {integrity: sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==} @@ -14301,7 +14233,7 @@ packages: /super-simple-web-server@1.1.4: resolution: {integrity: sha512-sQdVXz8ZDBMloocL63mifyVVzhxP55MlO2F0MiYJAJQiHTp42M2C3m2dZBIxGkcC7NUDr1/p0UhvGQvOsxZLpw==} dependencies: - express: 4.18.3 + express: 4.19.2 transitivePeerDependencies: - supports-color dev: true From 0a071e94222e760e29aaf958468da839c56d2bdb Mon Sep 17 00:00:00 2001 From: Mayank <9084735+mayank99@users.noreply.github.com> Date: Tue, 26 Mar 2024 15:33:42 -0400 Subject: [PATCH 3/6] add `adoptedStyleSheets` fallback for older safari (#1954) Slight refactor of ShadowRoot, with the main change being that when adoptedStyleSheets is not supported, an inline : null; + + return shadowRoot ? ( + ReactDOM.createPortal( + <> + {fallbackCss} + {children} + , + shadowRoot, + ) + ) : ( +