-
Notifications
You must be signed in to change notification settings - Fork 85
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
DatePicker selection close its parent ContextMenu #6986
Comments
B"H |
Unfortunately, I couldn't find a cleaner workaround for this: // Register a listener that prevents all context-menus from closing when the UI has "preventContextMenuClose" property set true (only need to run this once)
UI.getCurrent().getElement().executeJs("this.addEventListener('items-outside-click', function(e){ this.preventContextMenuClose && e.stopPropagation()}, true)");
datePicker.addOpenedChangeListener(e -> {
// Toggle the property that prevents the context-menu from closing
UI.getCurrent().getElement().setProperty("preventContextMenuClose", e.isOpened());
}); |
Thanks a lot Tomi! will try that |
The problem is still present as of Vaadin 20.0.5, see example below.
Interesting observation is that Combobox, which also has its own overlay, works fine and keeps the menu open upon selection. |
B"H |
Related issue: #4491 |
We are having the same issue we improved the workaround so it needs to be execute just once and if executed multiple times doesn't leak any listener. It also work with DateTimePicker which doesn't have addOpenedChangeListener
|
Issue still there on Vaadin24. |
Issue also exists when using a date(time)picker in a popup (https://vaadin.com/directory/component/popup). We're on vaadin 23.3.16. Any timeline for fixing this very annoying issue? @web-padawan When using it in such popup adding this workaround on Data(Time)Picker construction works for us:
|
Better way to reproduce:
Compare the behavior of ComboBox and DataPicker. Selecting ComboBox value does not close the Popup, selecting the Date on the other hand closes it. Popup is from https://vaadin.com/directory/component/popup |
I think this is related to vaadin/flow-components#1156 ComboBox has this prevented, but DatePicker not https://github.com/vaadin/web-components/blob/main/packages/combo-box/src/vaadin-combo-box-mixin.js#L427 |
Related to the above: unlike |
@web-padawan I do not quite follow your point. Both DatePicker and ComboBox work in similar fashion when opening the drop down. E.g. if I use keyboard cursor down, the focus jumps to overlay, and I can select item / date with keyboard. Interestingly when I am doing this fully on keyboard, the closing of DatePicker overlay does not lead to closing of the Popup, unlike when picking the date with the mouse. Are you specifically now referring to fact that when I open DatePicker dropdown by pressing cursor down, the DatePicker emits blur event in the process, ComboBox does not? |
In case of ComboBox, focus stays in the |
This issue was fixed and will be available with the next release. |
This issue appears to be a problem with Select component as well. The expected behaviour would be to not close the Popup component, when an item is clicked inside Select component item list. Example code
I'm using Vaadin 24.4.0.alpha16 version. |
@wtomee Please create a new issue for this so we could discuss it and then potentially take into backlog. |
B"H
While push DatePicker inside ContextMenu, when picker is use, both picker and ContextMenu are closed, Looks like closing event is leak to the layer next after
Button popupButton = Button("pop");
VerticalLayout layout = new VerticalLayout();
layout.add(new DatePicker("date picker"));
ContextMenu popup = new ContextMenu(popupButton);
popup.add(layout);
popup.setOpenOnClick(true);
The text was updated successfully, but these errors were encountered: