Skip to content
This repository has been archived by the owner on Sep 11, 2021. It is now read-only.

What about closing dropdown when clicking elsewhere #16

Open
vedmant opened this issue Jun 11, 2020 · 8 comments
Open

What about closing dropdown when clicking elsewhere #16

vedmant opened this issue Jun 11, 2020 · 8 comments

Comments

@vedmant
Copy link

vedmant commented Jun 11, 2020

What about closing dropdown when clicking elsewhere? That's default behavior of all dropdowns.

@arimendelow
Copy link

Create a transparent button the size of the entire screen that closes the dropdown, and put it between your dropdown and the rest of your site.

@vedmant
Copy link
Author

vedmant commented Jun 12, 2020

@arimendelow The problem here is that other elements will not work when you click somewhere also mouse pointer will not change when you hovering other elements. So with this approach you need to click twice to click some other button when dropdown is active, that's not desired behaviour.

@arimendelow
Copy link

That’s generally what sites do, but you could also have a click event listener that closes the menu for any click of the mouse.

@vedmant
Copy link
Author

vedmant commented Jun 12, 2020

@arimendelow Popular UI frameworks handle this the proper way:
https://bootstrap-vue.org/docs/components/dropdown#dropdowns
https://vuetifyjs.com/en/components/buttons/#button-dropdown-variants
https://quasar.dev/vue-components/editor#Dropdowns

This is what I find problematic with Tailwind is that it requires to reinvent the wheel in many cases.

@arimendelow
Copy link

Tailwind is just a better way to write CSS. If you want full components, look into Tailwind UI. They’re doing amazing work on it!

@arimendelow
Copy link

To clarify: TW is not a UI framework. UI frameworks are opinionated and not suitable for devs that want to take ownership over the design of their application

@OlamiBounty
Copy link

You will have to implement that yourself.

@vedmant
Copy link
Author

vedmant commented Jun 13, 2020

@arimendelow for sure that what everyone says, but for me main issue with using Tailwind is reinventing wheel in many cases or adding non various Tailwind third party components with it's own styles and different vendors.

Why then there is dropdown example at all if this is only CSS framework. Just means that there is a huge demand for standard components like dropdowns / modals.

Looking forward to Tailwind UI framework.

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

No branches or pull requests

3 participants