NativeSelect selection of empty value

Hi, I have create a Native Select with empty value allowed and a caption for empty value defined, when I set selected item to null, the native select clear the selection instead of show the caption of empty value.
Is it a desidered behavior?

TIA
Cristian

What the Vaadin version do you use? And please provide the code example, because there is a number of ways how NativeSelect could be used.

With the code above, if you click “clear” when the native select has a selection, for example to Male, the field returns to clear situation, if you click clear when the native select has null caption selected, the field still remain to null caption.
There is no way for select a null caption by code. Same result with binding.

Vaadin 8.0.7

Cristian

VerticalLayout layout = new VerticalLayout();        
        NativeSelect<String> nativeSelect = new NativeSelect<String>("Gender");
        nativeSelect.setEmptySelectionCaption("Choose an option");
        Collection<String> nativeSelectItems = new ArrayList<String>();
        nativeSelectItems.add("Male");
        nativeSelectItems.add("Female");
        nativeSelect.setItems(nativeSelectItems);
        
        Button clear = new Button("Clear");
        clear.addClickListener(new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                nativeSelect.clear();
                
            }
            
        });
        
        Button unselect = new Button("Select Null");
        clear.addClickListener(new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                nativeSelect.setSelectedItem(null);
                
            }
            
        });
        
        layout.addComponents(nativeSelect, clear, unselect);
        
        setContent(layout);

This problem should be fixed now: https://github.com/vaadin/framework/issues/10937