baseweb icon indicating copy to clipboard operation
baseweb copied to clipboard

Tooltip/popover appears on switching browser tab

Open hhvys opened this issue 3 years ago • 3 comments

https://codesandbox.io/s/base-web-statefultooltip-forked-mkite3

Current Behavior

When we switch tab tooltip appears on the screen unexpectedly.

Expected Behavior

Tooltip should not appear on screen if it wasn't open last time the tab was switched.

Button was clicked before switching tabs. Screen Recording 2022-02-09 at 2 12 25 PM

Your Environment

Tech Version
Base UI v10.8.0
React 17.0.2
browser Chrome
  • [x] I have searched the issues of this repository and believe that this is not a duplicate.

hhvys avatar Feb 09 '22 08:02 hhvys

Thank you for the bug report @hhvys. I personally cannot reproduce this. If anyone else can, please share your reproduction steps

chasestarr avatar Feb 10 '22 19:02 chasestarr

Hi 👋 I was able to replicate this one. The appears to be caused by a combination of Button (a focus-able element) & the autoFocus prop. Because clicking on the button will lock focus to it, switching to another tab and back will re-trigger the popover. One workaround is to add the focusLock prop, which locks focus to the popover content instead of Button:

https://codesandbox.io/s/base-web-statefultooltip-forked-62xce8?file=/src/example.js

brycedorn avatar May 09 '22 12:05 brycedorn

Thanks @brycedorn.

@chasestarr updated link of the example as well.

hhvys avatar Jul 19 '22 10:07 hhvys