Opened 7 years ago

Closed 7 years ago

#8846 closed feature (notabug)

Allow Default Click Event on Elements Within Selectable - Feature Request

Reported by: chrishiestand Owned by:
Priority: minor Milestone: 1.10.0
Component: ui.selectable Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:

Description

The current lack of default click or double-click events for selectable elements is frustrating. The "distance" parameter is not a sufficient workaround for many cases.

I have a couple ideas that I think would fix the problem.

  1. Allow default clicks on anything that does not match the filter option. In the example below, the filter only matches span elements. But at the moment, the links cannot be clicked. These could be allowed.
<ul class="ui-selectable" id="selectme">
  <li><span>Here is item 1</span> <a href="1">(1 It would be useful to be able to click here)</a></li>
  <li><span>Here is item 2</span> <a href="2">(2 It would be useful to be able to click here)</a></li>
  <li><span>Here is item 3</span> <a href="3">(3 It would be useful to be able to click here)</a></li>
</ul>

<script type="text/javascript">
$(function() {
        $( "#selectme" ).selectable({
          filter: 'span',
        });
    });
</script>
  1. Add a separate filter, e.g. "defaultEventFilter" that determines which elements will fire their default event.
<script type="text/javascript">
$(function() {
        $( "#selectme" ).selectable({
          defaultEventFilter: 'a',
        });
    });
</script>
  1. ??? Whatever implementation is best is fine with me. But I think this behavior need to be improved.

Change History (2)

comment:1 Changed 7 years ago by chrishiestand

Nevermind, the "cancel" option does exactly this, but I did not notice it earlier. Let's close this ticket.

comment:2 Changed 7 years ago by Jörn Zaefferer

Resolution: notabug
Status: newclosed

Alright, thanks for the update.

Note: See TracTickets for help on using tickets.