Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deselect event #586

Closed
wants to merge 5 commits into from
Closed

Deselect event #586

wants to merge 5 commits into from

Conversation

dingram
Copy link
Contributor

@dingram dingram commented Apr 20, 2012

A few things in this pull request -- let me know if you'd prefer them to be seperate.

  1. Fixed the Cakefile so it doesn't conflict with the node.js reserved word package
  2. Added support for a data-removable attribute on option elements in a multiple-select box, which can be set to "0" in order to stop them being deselected
  3. Added support for a cancelable liszt:deselect event, so runtime code can decide whether to allow an item to be deselected. This can be prevented by calling the preventDefault() (jQuery) or stop() (Prototype) methods on the event object.

@pfiller
Copy link
Contributor

pfiller commented Apr 20, 2012

Thanks so much, @dingram. It's almost always a good idea to keep pull requests in more logical groupings -- so that their individual merits can be discussed. I'm going to weigh in on some stuff and then would welcome you to resubmit that way.

Fixed the Cakefile so it doesn't conflict with the node.js reserved word package

Please submit the Cakefile change as a separate PR - this can be merged no problem.

Added support for a data-removable attribute on option elements in a multiple-select box, which can be set to "0" in order to stop them being deselected

As mentioned in #516, there is already an html attribute that makes sense to use here. Any element that is disabled should not be able to be deselected. However, this requires a style change to show the user that there is something different about that element (read the full notes on that issue).

Additionally, as this is built now, it won't work. Simply hiding the x is not sufficient to stopping an element from being removable. You can highlight the Chosen field and backspace to remove an element as well.

Added support for a cancelable liszt:deselect event, so runtime code can decide whether to allow an item to be deselected. This can be prevented by calling the preventDefault() (jQuery) or stop() (Prototype) methods on the event object.

I'm not sure what the use case is for this. Why would you want to stop a selection instead of using the disabled attribute discussed for the second portion?

Feel free to continue the discussion here, but I'm going to close this pull request. After a discussion, I'd welcome you to re-open numbers 2 & 3 if appropriate.

Thanks again.

@pfiller pfiller closed this Apr 20, 2012
@dingram
Copy link
Contributor Author

dingram commented Apr 21, 2012

It's almost always a good idea to keep pull requests in more logical groupings -- so that their individual merits can be discussed.

Yeah, sure. Looking at it from the point of view of the project owner, these should definitely have been at least two requests; my apologies. I'll submit the Cakefile change seperately in a moment or two.

As mentioned in #516, there is already an html attribute that makes sense to use here. Any element that is disabled should not be able to be deselected. However, this requires a style change to show the user that there is something different about that element (read the full notes on that issue).

That makes complete sense, and I should have thought of it before. I'll look into updating the code to handle things that way instead.

Simply hiding the x is not sufficient to stopping an element from being removable. You can highlight the Chosen field and backspace to remove an element as well.

Heh, thanks -- I'd completely missed that possibility. I'll make sure I take it into account too.

Added support for a cancelable liszt:deselect event, so runtime code can decide whether to allow an item to be deselected. This can be prevented by calling the preventDefault() (jQuery) or stop() (Prototype) methods on the event object.

I'm not sure what the use case is for this. Why would you want to stop a selection instead of using the disabled attribute discussed for the second portion?

That's a good point, and I hadn't considered it. I now can't think of any reasoning for this :-(

@pfiller
Copy link
Contributor

pfiller commented Apr 23, 2012

Thanks for following up, @dingram. If you get a version working with disabled elements and some kind of style change, I'd love to see it resubmitted. It'd be worthy of a merge for sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants