flow-components icon indicating copy to clipboard operation
flow-components copied to clipboard

Allow ContextMenu to stay open when programmatically requested

Open enver-haase opened this issue 2 years ago • 8 comments

Describe your motivation

When a ContextMenu is open, then some users would like to select a number of things in that menu. For example, one could want to pin a number of entries, comparable to a MultiSelectComboBox.

Describe the solution you'd like

contextMenu.setCloseOnInsideClick(false); contextMenu.setCloseOnOutsideClick(false); // the two lines above leave only contextMenu.close() // as the only option to close the context menu.

Describe alternatives you've considered

none

Additional context

This is requested by one of our customers who use this approach to pin several items in the ContextMenu. Their solution is brittle/error-prone because it is client-side and implementation-dependent. They would like official API for that.

enver-haase avatar Jan 22 '24 18:01 enver-haase

Context menu items have a setKeepOpen API that keeps the menu open when they are clicked (#5398). There is no API to prevent closing on outside click though AFAIK.

sissbruecker avatar Jan 23 '24 08:01 sissbruecker

@enver-haase, would setKeepOpen suit customer request or would prevention of closing on outside click be needed as well?

yuriy-fix avatar Feb 01 '24 14:02 yuriy-fix

Yes, the prevention of closing on outside click would be needed as well.

enver-haase avatar Feb 01 '24 14:02 enver-haase

Customer just realised that a context menu at this time even closes when there is a TextField added as a component and they try to navigate the cursor to the left within the TextField.

So, CURSOR-LEFT shall also not blindly and automatically close the context menu.

enver-haase avatar Feb 06 '24 14:02 enver-haase

Context menu items have a setKeepOpen API that keeps the menu open when they are clicked (#5398). There is no API to prevent closing on outside click though AFAIK.

Do I see that right that while 23.3.3 has it and 24.x has it, it is missing in 23.3.30 and 23.3.32, for example?!

enver-haase avatar Feb 06 '24 14:02 enver-haase

Customer also realised that right-clicking closes -- also not wished for.

Suggestion is to have a ContextMenu-wide solution rather than fine-grained individual solutions on MenuItem level.

enver-haase avatar Feb 06 '24 15:02 enver-haase