Open vdytynyuk opened 7 years ago
This one is mysterious a bit. I've created new blank project with only one button and modal on it, and dropdowns worked fine on modal. But on my main project same code still doesn't work. Specifically class show
is not being applied to dropdown container in order to show menu items. Can this one be some kind of layouts-related issue?
Hi @bikalay I've found root of this problem and changed title of issue accordingly. The point here is that modal
is a child of backdrop
element on DOM. And backdrop is being implemented just like that:
closeByClickOutside() {
const containerEl = this.container.nativeElement;
containerEl.querySelector('.modal-content').addEventListener('click', (event)=> {
event.stopPropagation();
});
containerEl.addEventListener('click', () => {
this.dialogService.removeDialog(this.content);
}, false);
}
}
So any onclick
cannot be propagated when raised from modal dialog. Is there a strong reason why you keep current structure of modal & backdrop elements as parent-child instead of siblings one?
Same issue here, when I set closeByClickingOutside = true, all dropdowns became broken, I use primeng p-dropdown. Very strange behavior, first time click event fires and I can choose a value, but then I'm not able to open dropdown again. Any plans to fix this ?
Is this still happening??
I fixed it by changing the eventlistener to 'mouseup' in dialog-wrapper.component.js. MouseUp event triggers after click.
closeByClickOutside() {
const containerEl = this.container.nativeElement;
containerEl.querySelector('.modal-content').addEventListener('mouseup', (event)=> {
event.stopPropagation();
});
containerEl.addEventListener('mouseup', () => {
this.dialogService.removeDialog(this.content);
}, false);
}
}
Dropdown button seems to be totally inactive when it comes within modal. Here's my code:
Has anyone encountered same issue?