Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Prevent dropdown close on selection with multiple attribute #339

Closed
@AntiFreez

Description

@AntiFreez

I tried to prevent dropdown closing, when user selects item from the list. Therefore, i have created "extended" directive and overrode standard behaviour of the select method. And it works, but only in case of selection by keyboard. The problem, that link function adds event listener on document click to provide dropdown closing, when user clicks outside component.

function onDocumentClick(e) {
   var contains = false;

   if (window.jQuery) {
      // Firefox 3.6 does not support element.contains()
      // See Node.contains https://developer.mozilla.org/en-US/docs/Web/API/Node.contains
      contains = window.jQuery.contains(element[0], e.target);
    } else {
       contains = element[0].contains(e.target);
    }

    if (!contains) {
       $select.close();
       scope.$digest();
    }
}

And this listener always closes dropdown when user selects item by mouseclick.
Here is my example http://plnkr.co/edit/sNNgeO4epaMUZosqpAir?p=info

Would you like to add this functionality to standard behaviour?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions