MD Settings: implement a settings-checkbox-change event. |
||||||
Issue descriptionAt https://codereview.chromium.org/2501783003, I use an iron-change event to detect changes to a settings-checkbox. While writing tests a subtle bug was revealed. 'iron-change' is fired by the paper-checkbox inside the settings-checkbox. Listening to iron-change outside of the settings-checkbox (with bubbling), is not safe, because the surrounding settings-checkbox has not updated itself yet, so it does not have the "checked" HTML attribute yet. In other words, the 'iron-change' listener executes before the settings-checkbox#checkedChanged_ observer has fired, and before settings-checkbox has updated its internal state to reflect the 'checked' Polymer property as an HTML attribute.
,
Nov 16 2016
At the very least we should not be letting the iron-change event propagate through settings-checkbox to parents, because this just allows a future developer to get confused, the same way I was confused. Firing a 'settings-checkbox-change' at the right time, when both the Polymer property and the HTML attribute 'checked', have been updated seems the best solution. I'll reopen for now.
,
Nov 28 2016
,
Jan 7 2017
,
Feb 21 2018
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue. Sorry for the inconvenience if the bug really should have been left as Available. If you change it back, also remove the "Hotlist-Recharge-Cold" label. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Jul 21
Closing this bug. This element no longer uses paper-checkbox internally, and #2 makes a good point. If we want to be extra careful, we could call stopPropagation() on any events that come from internal elements and are not meant to be bubbled to clients. |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by dbeam@chromium.org
, Nov 16 2016