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

disabled buttons with icons #3159

Closed
sandeepmovva opened this issue Apr 19, 2012 · 7 comments
Closed

disabled buttons with icons #3159

sandeepmovva opened this issue Apr 19, 2012 · 7 comments

Comments

@sandeepmovva
Copy link

Disabled buttons with icons act weirdly in that clicking on the button doesn't do anything but clicking on the icon within the disabled button triggers the click event on the disabled button.

In this example, clicking around the envelope but within the button does nothing, as expected.
But, clicking on the envelope triggers the click event.

http://jsfiddle.net/blissfulignant/Rypse/5/

@sandeepmovva
Copy link
Author

I guess this is specific to my implementation as I inject elements dynamically.

Seems like the only way around it is to prevent propagation manually ala $(':disabled i').on('click', false);

@shorrockin
Copy link

Can you explain why you think this is specific to your implementation? I'm experiencing the same thing and your fiddle example seems to indicate it doesn't have anything to do with dynamic element injection?

@sandeepmovva
Copy link
Author

I realized that this is not specific to my implementation and am including that code snippet above to fix that in my app.

@c4urself
Copy link

c4urself commented Feb 1, 2013

This should be reopened I'm having the same issue -- no dynamic injection at all. When clicking on an icon that is in a disabled button the click event goes through.

@sandeepmovva
Copy link
Author

Adding the code snippet above is the solution.

They've made it pretty clear that the disabled class is just for aesthetics and it's up to you to handle clicks. (Source: http://twitter.github.com/bootstrap/base-css.html#buttons)

@c4urself
Copy link

c4urself commented Feb 3, 2013

There's:

class="disabled"
and
disabled="disabled"

I agree the prior would be an aesthetic thing but the latter should function like any disabled button should, and not be clickable. Placing icons within the button breaks this.

@chadwilcomb
Copy link

The jQuery solution above won't work if View is created/rendered after page load, but you can add this to your view:
events: { button:disabled i": "disableClick" }
disableClick: function (e) { e.stopPropagation(); }

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

No branches or pull requests

4 participants