-
Notifications
You must be signed in to change notification settings - Fork 355
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
Regular input type #26
Comments
I have made this component which do quite what I want!
The problem is I couldn't show the picker the focusin/focusout input event because when I try to chose the color the focusout event triggers and close the picker! So I put a click event on the icon which toggles it! Any ideas? |
Hi there, do you want to show the picker on focus instead of click ? When you said "I put a click event" are you referring to this have you tried |
Hey Cassio! About the click event it is related to the code highlighted by you! I can't do it on the The best approach is to close when the user clicks outside picker or when the main click lost focus! I tried also listen the focusout event on the root element but when I click to choose my color it also triggers the focusout event even when my picker is inside the root element! So the closest to the best approach that I got is this:
|
The way you want to close/show the picker is pretty much up to you since the pickers don't have a close button or event. With a button to open, it's an option to use the same button to close. Clicking outside the picker is trickier to know that, the parent or a Vuex state could know about the the children states, or even control(parent knows which child is open at the moment). Googling for the picker you mentioned, it closes one picker when other is opened, actually when other input is focused. To achieve that I would recommend this parent-child communication, parent knowing who is open and the child asks to close any other picker open on focus. vue-color uses a lot of You can check here more about the events: https://github.com/xiaokaike/vue-color/blob/master/src/components/common/Hue.vue#L105 Other possible solution is to build your own picker with separate components, if you need more customization. Here it is some of the components you can use: https://github.com/xiaokaike/vue-color/blob/master/src/index.js (you need to import them individually) |
@gustavobissolli maybe this will help you: https://github.com/simplesmiler/vue-clickaway If that helps, please close the issue. |
Is there any solution for regular input as bootstrap-colorpicker?
The text was updated successfully, but these errors were encountered: