File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515'use strict' ;
1616
1717( ( ) => {
18+ const radioGroups = { } ;
19+
1820 // Setup uncheckable radios.
1921 const setupUncheckableRadio = ( radio ) => {
2022 if ( ! radio . dataset . uncheckableRadioButton ) return ;
2123 delete radio . dataset . uncheckableRadioButton ;
2224
25+ if ( ! radioGroups [ radio . name ] ) radioGroups [ radio . name ] = [ radio ] ;
26+ else radioGroups [ radio . name ] . push ( radio ) ;
27+
2328 if ( radio . checked ) radio . dataset . currentlyChecked = '1' ;
2429
2530 radio . addEventListener ( 'click' , ( e ) => {
31+ for ( const groupRadio of radioGroups [ radio . name ] ) {
32+ if ( groupRadio === radio ) continue ;
33+ delete groupRadio . dataset . currentlyChecked ;
34+ }
2635 if ( radio . dataset . shift && ! e . shiftKey ) {
2736 radio . dataset . currentlyChecked = '1' ;
2837 return ;
2938 }
30- const currentlyChecked = radio . dataset . currentlyChecked ;
31- if ( currentlyChecked ) {
39+ if ( radio . dataset . currentlyChecked ) {
3240 delete radio . dataset . currentlyChecked ;
3341 radio . checked = false ;
3442 } else {
You can’t perform that action at this time.
0 commit comments