wbadam / autocomplete-extension

Autocomplete extension add-on for Vaadin 8
https://vaadin.com/directory#!addon/autocomplete-extension
8 stars 7 forks source link

lost focus if enable overflow-y: scroll on div that contains item list #25

Open FabioConte opened 5 years ago

FabioConte commented 5 years ago

To solve this issue is necessary add Prevent blur on text field before click. To do this you can modify class SuggestionList, add this method

private void onMouseDown(Event event) {
    // Prevent blur on text field before click on scroll
    event.preventDefault();
}

add this attribute

private EventListener onMouseDown = this::onMouseDown;

And add to method create wrapper this two line

    EventTarget divTarge = div.cast();
    divTarge.addEventListener(BrowserEvents.MOUSEDOWN, onMouseDown);

I hope this help someone