Created by: icio
Unlike any of the other browsers, Firefox will restore <input>s' checked status after a page refresh. (This behaviour can be suppressed with autocomplete=off on the form or input.) You can see this in action on 4.4.1 by selecting the last example radio then refreshing.
Other browsers and Firefox will restore the <inputs>s' checked status after navigating away from a page then navigating back. There's #25122 (closed) documenting this, which we can resolve by updating the initial button state on window pageshow
as-well as load
.
Trying to fix all of those things lead me to this PR, where button toggles with label/input rely on change events to update state, and .btn[data-toggle=button]
remains handled by click events.
First PR here so feedback on testing/style/anything gratefully received.
I made the mistake of branching off v4-dev. Apologies
If a CSS-only alternative proves difficult, the toggle control could be far simpler if only label>input based markup is supported because we can then toggle the active class through the change event alone.