Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: popup doesn't close after fastest hover over target element #44

Open
dail45 opened this issue Jan 17, 2025 · 1 comment
Open

bug: popup doesn't close after fastest hover over target element #44

dail45 opened this issue Jan 17, 2025 · 1 comment

Comments

@dail45
Copy link

dail45 commented Jan 17, 2025

What version of FlyonUI are you using?

1.3.0

Which browsers are you seeing the problem on?

All browsers

Reproduction URL

https://flyonui.com/docs/overlays/tooltip/

Describe your issue

Image
If you quickly swipe the tooltip activation element, the hint will appear and will not disappear (very easy to get with the console open, but that doesn't mean it's impossible without it)

Code:
src/js/plugins/tooltip/index.ts:166

private _show() {
    this.content.classList.remove('hidden')
    if (this.scope === 'window') this.content.classList.add('show')

    if (this.preventPopper === 'false') {
      this.popperInstance.setOptions(options => ({
        ...options,
        modifiers: [
          ...options.modifiers,
          {
            name: 'eventListeners',
            enabled: true
          }
        ]
      }))

      this.popperInstance.update()
    }

    setTimeout(() => { // Why needs this setTimeout? #185
      this.el.classList.add('show')

      this.fireEvent('show', this.el)
      dispatch('show.tooltip', this.el, this.el)
    })
  }

public hide() {
    this.el.classList.remove('show') // where setTimeout if it needs?
...

Problem timeline:

  1. invoke _show
  2. setTimeout
  3. hide (remove class "show" but it not exists)
  4. setTimeout from step 2 is running and add class "show"
  5. I'm writting issue

Possible solution:
remove setTimeout from 185 line.

Copy link

Hi @dail45

Thank you for your support in helping us improve FlyonUI!

We’ve received your submission and will respond within few business days. Our team handles issues one at a time, and we’ll be reviewing yours as soon as possible.

In the meantime, any additional details or a reproducible example would be greatly appreciated and will help us resolve the issue more efficiently.

Thank you for your patience and understanding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant