paper-checkbox icon indicating copy to clipboard operation
paper-checkbox copied to clipboard

Consider styling using CSS and not a computed class, to get around weird UI bug when checked='null'

Open bvhme opened this issue 9 years ago • 10 comments

I have an object from firebase-document with booleans inside it and am using two way databinding to update them. If the object changes the checkmark and its value change accordingly but the background-color of the checkbox is never changed.

bvhme avatar Jan 30 '16 12:01 bvhme

I think there's something incorrect in your setup. Here's a JSBin with a bunch of two-way-binded items, and the checkbox selects and deselects correctly: http://jsbin.com/lahoyi/edit?html,output.

Going to close this since I can't repro, but please re-open if you can provide an actual example where this is broken and that we can debug :(

notwaldorf avatar Feb 03 '16 22:02 notwaldorf

@notwaldorf Try this one, put a into the input, then try b, then c then d http://output.jsbin.com/huwesenilo/

bvhme avatar Feb 03 '16 23:02 bvhme

It looks ok? 2016-02-03 15_42_42

notwaldorf avatar Feb 03 '16 23:02 notwaldorf

Interesting, but if i type 'bb' I see what you mean. Hmm.

notwaldorf avatar Feb 03 '16 23:02 notwaldorf

It's the only element that seems to do this, and I've run into it in multiple projects, all related to the firebase objects though being hotswapped out

bvhme avatar Feb 03 '16 23:02 bvhme

When I type bb, _computeCheckboxClass: function(checked, invalid) isn't called, which means that checked doesn't actually change. What does object.checked3 actually return? Is it undefined by any chance?

notwaldorf avatar Feb 03 '16 23:02 notwaldorf

(as in: when I'm debugging, it seems that when I type bb in your demo, checked is set to undefined, which makes sense why the _computeCheckboxClass method isn't called).

This doesn't happen for toggle or radio button because the way the change their css is different.

notwaldorf avatar Feb 03 '16 23:02 notwaldorf

Yeah, it returns null I think, or is just not defined, which probably doesn't kick off the computed property...

bvhme avatar Feb 03 '16 23:02 bvhme

@notwaldorf Should this be reopened or is it not a bug?

bvhme avatar Feb 04 '16 11:02 bvhme

I don't think it's really a bug, since it looks like you're using the attribute incorrectly (setting checked='undefined' is not correct).

But I do agree that maybe we should, for consistency, style in css using attributes vs. using a computed class, which would at least make the element consistent with the radio-button, for example.

I'll re-open and retitle

notwaldorf avatar Feb 04 '16 20:02 notwaldorf