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

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

Closed
wants to merge 4 commits into from

Conversation

moshetanzer
Copy link
Collaborator

@moshetanzer moshetanzer commented Feb 25, 2024

πŸ”— 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
Collaborator Author

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

@moshetanzer
Copy link
Collaborator Author

moshetanzer commented Feb 25, 2024

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
Collaborator 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
Collaborator Author

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

Copy link
Member

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

@moshetanzer
Copy link
Collaborator Author

moshetanzer commented Feb 26, 2024

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
Copy link
Member

benjamincanac commented Mar 4, 2024

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.

None yet

4 participants