Skip to content

fix(Popover): prevent need for double click with hover mode on mobile#1415

Closed
moshetanzer wants to merge 4 commits into
nuxt:devfrom
moshetanzer:patch-2
Closed

fix(Popover): prevent need for double click with hover mode on mobile#1415
moshetanzer wants to merge 4 commits into
nuxt:devfrom
moshetanzer:patch-2

Conversation

@moshetanzer

@moshetanzer moshetanzer commented Feb 25, 2024

Copy link
Copy Markdown
Contributor

🔗 Linked issue

There must already be an issue - though havent found one to link.

Here is a link to an issue i opened on new undocs website

unjs/undocs#69

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

When a popover is set to mode=hover, on mobile one is required to press the button twice to open the popover. Have committed most simple fix, could be a better way to do this...

This is quite a big issue since it is being used on all Nuxt website and is encountered in UI Pro templates.

Here is a video of issue:

Screen.Recording.2024-02-25.at.19.03.29.mov

Reproduction of issue is on the ui.nuxt.com docs for popover - just go into mobile simulator or go on actual mobile device:
https://ui.nuxt.com/components/popover

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@moshetanzer

Copy link
Copy Markdown
Contributor Author

This PR doesn't seem to have solved the issue on IOS, on chrome mobile simulator was solved though🤔. Any ideas.

@moshetanzer

moshetanzer commented Feb 25, 2024

Copy link
Copy Markdown
Contributor Author

Two suggestions I can think of are;

  • preventDefault or void() - maybe..
  • mouseenter instead of mouseover or mousedown - maybe...

--
another hacky solution could be adding 100ms as default timeout... IOS.... - this would prob work
maybe using @touchstart event and disabling other event... - will also work just a bit hacky
another solution could be to use dynaimc classes and remove hover and use advanced media queries for touch event... using media match pointer coarse

@moshetanzer

Copy link
Copy Markdown
Contributor Author

Though android is solved...🙈

@benjamincanac benjamincanac changed the title fix: prevent need for double click on button to open popover when mode=hover on mobile fix(Popover): prevent need for double click with hover mode on mobile Feb 26, 2024
@moshetanzer

Copy link
Copy Markdown
Contributor Author

Hi @benjamincanac any idea of best way to implement to work both on iOS and android. This literally affects all Nuxt UI websites.

@benjamincanac

Copy link
Copy Markdown
Member

I don't have a clue yet but I agree this is urgent! I'll try to dig as soon as possible

@moshetanzer

moshetanzer commented Feb 26, 2024

Copy link
Copy Markdown
Contributor Author

Not sure what your code design standards are. But media query option may be good.

Either options mentioned above, or have allows at this tailwindlabs/tailwindcss#8394

Did a bit more research, these seem to be most useful somehting like this:

media (hover: hover) and (pointer: fine) { .hover\:underline:hover { text-decoration-line: underline; }

Edit
hoverOnlyWhenSupported - doesn't fix issue in IOS.

Happy to do a bit more testing. Let me know your thoughts.

@benjamincanac

benjamincanac commented Mar 4, 2024

Copy link
Copy Markdown
Member

Closing in favor of 70bf4a7 and b50fbcf.

@moshetanzer moshetanzer deleted the patch-2 branch March 4, 2024 10:51
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

Successfully merging this pull request may close these issues.

4 participants