bezier-react icon indicating copy to clipboard operation
bezier-react copied to clipboard

tooltip을 벗어나 마우스를 빠르게 tooltip으로 hover하면 tooltip이 사라지지 않음

Open danivelop opened this issue 4 years ago • 1 comments

현재상황

마우스를 hover하여 tooltip이 나타나도록 한후 해당 영역을 벗어나 tooltip이 사라지기전 빠르게 tooltip위로 마우스를 hover하면 tooltip이 사라지지 않음(allowHover옵션이 없음에도) allowHover가 false때는 마우스가 영역을 벗어나면 tooltip이 사라지는게 보장되도록 변경필요

재현 방법

기대한 동작

실제 동작

Reference

danivelop avatar Apr 15 '21 10:04 danivelop

  const handleMouseEnter = useCallback(() => {
    if (disabled) {
      return
    }

    if (timerRef.current) {
      clearTimeout(timerRef.current)
    }

    timerRef.current = window.setTimeout(() => {
      setShow(true)
    }, delayShow)
  }, [
    delayShow,
    disabled,
  ])

  const handleMouseLeave = useCallback(() => {
    if (disabled) {
      return
    }

    if (timerRef.current) {
      clearTimeout(timerRef.current)
    }

    timerRef.current = window.setTimeout(() => {
      setShow(false)
    }, delayHide)
  }, [
    delayHide,
    disabled,
  ])

혹시 setTimeout이 왜 들어갔는지 알 수 있나요? 이게 0초라도 stack에는 늦게들어가서 지연될 수 있는데 관련이 있어보입니다.

Seolhun avatar Dec 08 '21 09:12 Seolhun

Fixed with #1291

sungik-choi avatar Jun 21 '23 05:06 sungik-choi