-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Don't trigger action if its element is disabled #2240
Conversation
+1 |
Should it still prevent-default if the element is disabled? Thinking of links with href, if it's disabled then you'd click it and end up navigating to another page which probably isn't what should happen. Then again, technically |
At first, I thought it should Then I reconsidered. You could conceivably have a jQuery plugin that shows a "why is this button disabled?" tooltip if you ever try to click something that's disabled. (Or, if you think that's silly, a click tracker on a feature that's not yet built that you use to figure out whether people are interested in the feature.) Then I reconsidered again: there's already the |
@jamesarosen if I'm coming round to thinking that the disabled check should move down a few lines under the bubble check but will wait to see what others think before updating the pull request. |
I'm not sure that I really like the action helper checking for attributes. At the same time I understand the usefulness of this change. I'd like to hear a bit more discussion on this. |
@wagenet AFAICT, the only alternative would be to use a custom view class that includes Is it possible that the I guess the other option is to say that the |
@jamesarosen We've implemented that exact solution of a small view mixing in the TargetActionSupport and on the click function... click: function () {
if (!this.get('disabled') && !Em.isEmpty(this.get('action'))) {
this.triggerActionWithContext();
}
} (We extened TargetActionSupport to include context) |
I don't think |
This leaves Ember without a default way of building a button that can be disabled. Yes, you can always build a view with |
@jamesarosen what do you think about the approach of adding an option to the |
Totally decent :) |
Maybe you or @rlivsey want to implement? |
@jamesarosen If you use a |
@kselden that might just be crazy enough to work. |
As I understand this PR hasn't been merged yet? |
if isWidgetHasTitle returns either true, or false, the disabled attribute is never even set, or respected, on my button. view code:
I've tried returning true and "true", false and "false" just in case. Neither provides even setting the disabled property, much less anything else in this thread. thoughts? |
@rstudner This should work and seems like a separate issue. Please create a JSFiddle and ask if someone on IRC in #emberjs can review. |
Fixes #1936