In a Vaadin 8.1.3 app, I have a NativeSelect component on a layout, with a CheckBox next to it. The listener on the checkbox calls setEnabled on the popup-menu (the NativeSelect), passing true or false.
If false, I expected the widget to be dimmed in appearance, per the documentation. And I expected the popup menu to no longer pop up when clicked. Both of these expectations were not met. The widget does not change in appearance whether enabled or not. The widget continues to pop-up a menu when clicked. That's bad.
When enabled is set to false, choosing an item from the menu no longer triggers an event. The listener that responds to a value change on the menu no longer runs. That's good.
Is this a bug on the NativeSelect? The NativeSelect::setEnabled method documentation promises:
… The user can not interact with disabled components, which are shown with a style that indicates the status, usually shaded in light gray color. …
Is there some other way to dim the appearance of the NativeSelect and disable the display of its menu?
In summary, I am looking for three behaviors on a disabled popup menu:
- Grayed-out/dimmed appearance
- No longer pops up when clicked
- Generates no events when clicked
The setEnabled command seems to promise all three bullets but delivers only the last bullet.
I am surprised by this behavior, given that this is a "native" HTML object. The select HTML object is defined to have a disable attribute in both old HTML as well as HTML5. This attribute has both effects I need: alter display, and make un-clickable. See this explanation and this demo of the HTML select widget being disabled.
I filed Issue # 9956.

It's because Vaadin Component interface delivers two methods to adjust component:
setEnabled()andsetReadOnly()- which you are actually looking for.Here is my solution for you:
Add to css: