Please make parent click handling optional.
Closed this issue · 2 comments
roman-makaroff commented
In use case of sharing one picker instance across multiple buttons the 'parent'/container element may be different from the button (body or section). Click on parent should not always open the picker. So please add option to ignore handling on parent click
if (!settings.preventOpeningOnParentClick) {
this._events.add(parent, 'click', openProxy);
}
Sphinxxxx commented
Hello! Have you looked at the "Shared picker" example in the demo?
https://codepen.io/Sphinxxxx/pen/zRmKBX
If you still need more custom behavior, try attaching the picker to a common parent element and then hijack the openHandler()
method to control when the picker should open:
const picker = new Picker({
parent: document.body,
...
});
picker.__originalOpenHandler = picker.openHandler;
picker.openHandler = function(e) {
if (shouldActuallyOpen) {
this.__originalOpenHandler();
}
};
Here is a working example of that last method:
roman-makaroff commented
Thank you!
…On Wed, Jul 13, 2022 at 8:03 AM Andreas Borgen ***@***.***> wrote:
Hello! Have you looked at the "Shared picker" example in the demo?
https://codepen.io/Sphinxxxx/pen/zRmKBX
If you still need more custom behavior, try attaching the picker to a
common parent element and then hijack the openHandler() method to control
when the picker should open:
const picker = new Picker({
parent: document.body,
...});
picker.__originalOpenHandler = picker.openHandler;picker.openHandler = function(e) {
if (shouldActuallyOpen) {
this.__originalOpenHandler();
}};
Here is a working example of that last method:
https://jsfiddle.net/9g4nsdz3/2/
—
Reply to this email directly, view it on GitHub
<#47 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJTWEGDSA2HPPLIVAU257LVTZE2VANCNFSM53FYQVHA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>