-
Notifications
You must be signed in to change notification settings - Fork 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
button value binding does not work if button has nested elements #2497
Comments
I'd suggest not using |
I know that JavaScript function instead of inline event handler works correct, but in our system we use integer properties to trigger button click on server side. It is really annoying to add click function for each button to just increment a value. |
Why don't you create a fancy-button that does that and reuse it everywhere? |
Well, I did something like this, but the exception with binding is still there and should be fixed. |
This is really annoying and it took me again half a day of debugging to find the problem. Could someone fix this? It can’t be to complicated. |
+1 |
+1. Just spend 2 hours debugging this case :( |
I suspect it's something related to event delegation/ event target handling, as existence of nested element does not break a thing, but clicking on the element inside which may not be bound to anything breaks it: |
Organically a button's value is the buttons name. You can use other props or reset value. I have a universal input which does everything from buttons, toggles, papering icon buttons, check boxes radio groups native selects with items entered as atts or nested dom repeats. For buttons I find using a section or span or similar to wrap an icon is easiest And allows for a button set based on CSS classes which I assign at Dom repeat instance no via input type tied classes and secondary classes in another on top prop. The button value like the radio ad check box value are just not "value tied" natively so a secondary prop is the usual method. If you monkey with it you could more or less do anything. It's up to you really Sent from my iPhone
|
+1 |
+1 extremely annoying bug |
This issue has been addressed in #5308 and will be fixed in 2.x and 3.x. Therefore I am closing this issue, as it targets 1.x. Please update your version of Polymer once we have released the fixes. |
On my page I have a button:
The purpose of the button is to increase
model.value
by one and notify Polymer about the change. The code above works fine, but this one does not work:If
button
has any nested elements, thenmodel.value
becameundefined
on click. Here is a jsfiddle which demonstrates the issue: https://jsfiddle.net/z1knafu5/.The text was updated successfully, but these errors were encountered: