Open Date Picker when clicking at the calendar icon only?

Date Picker in Vaadin 14.1.23 opens the calendar widget when the user clicks on it, no matter whether the user clicks at the calendar icon or at the input element.

Is it possible to open the widget only at a click at the icon and prevent opening otherwise?

What I tried to suppress opening the picker widget:

A) addOpenedChangeListener and call setOpened(false) within the method “onComponentEvent”.
Observation: this is too late. the picker widget is opened already when the onComponentEvent is called and at least it pops up for a short time and then disappears. Not nice.

B) addFocusListener: this is also too late.

C) Override setOpened. Unfortunately the method is not called when the picker opens in the browser.

Hi!

The opening of the overlay happens at client-side. Because of the transmission delay, any event you use with server-side Java to react to the opening will be too late.

You can use JavaScript to prevent the input element from opening the overlay at client-side like this:

datePicker.getElement().executeJs(
        "this.$.input.addEventListener('click', function(e) { e.stopPropagation(); })");

Works great! Thank you.
Tested with Firefox 75.0 and Chromium 81.0.4044.92.