Skip to main content

Search and Top Navigation

#9196 closed bug (notabug)

Opened March 30, 2013 06:42AM UTC

Closed March 30, 2013 12:05PM UTC

Last modified March 31, 2013 10:37AM UTC

configure to disable unless modifier key is pressed

Reported by: penguin_brian Owned by:
Priority: minor Milestone: none
Component: ui.selectable Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:
Description

e.g. put something like

if (!event.metaKey && !event.ctrlKey && !event.shiftKey) {
   return;
}

At top of _mouseStart function. Might be better to make it configurable.

That way if there are links, etc, on this selectable item, the user can still click on the links, and get select functionality by using one of the modifier keys

Attachments (0)
Change History (5)

Changed March 30, 2013 12:05PM UTC by tj.vantoll comment:1

resolution: → notabug
status: newclosed

Hi penguin_brian,

Thanks for taking the time to contribute to the jQuery UI project. The

cancel
option (http://api.jqueryui.com/selectable/#option-cancel) should provide the functionality that you're describing: http://jsfiddle.net/tj_vantoll/9nR3c/.

Thanks.

Changed March 30, 2013 11:51PM UTC by penguin_brian comment:2

Interesting idea.

Unfortunately, that does not help in my case, as the entire item is clickable. I want to leave it as clickable if no modifier keys have been pushed.

Thanks

Changed March 31, 2013 01:42AM UTC by tj.vantoll comment:3

I don't believe this to be a common use case and you can accomplish this fairly easily with the cancel option: http://jsfiddle.net/tj_vantoll/wW6Fc/. If you need further help use the forums or Stack Overflow.

Changed March 31, 2013 03:13AM UTC by penguin_brian comment:4

Like I said, the cancel option does something different entirely. It does not solve my problem.

Changed March 31, 2013 10:37AM UTC by penguin_brian comment:5

So the best way forward might be for me to create a new widget derived from ui.selectable that overrides _mouseStart and only calls the parent class if my criteria is satisfied. Still learning jquery and jquery-ui, but it looks like it should be possible.