File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
packages/pf3-component-mapper/src/form-fields Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,14 @@ class Switch extends React.Component {
53
53
< label
54
54
className = { `pf3-switch${ disabled || isReadOnly ? ' disabled' : '' } ${ bsSize === 'mini' || bsSize === 'mn' ? ' mini' : '' } ` }
55
55
style = { { width : this . state . labelWidth + DIVIDER_SIZE + COMBINED_MARGIN } }
56
+ tabIndex = { disabled || isReadOnly ? - 1 : 0 }
57
+ onKeyDown = { ( e ) => {
58
+ const SPACEBAR_CODE = 32 ;
59
+ if ( e . keyCode === SPACEBAR_CODE ) {
60
+ e . preventDefault ( ) ;
61
+ props . onChange ( { target : { checked : ! props . checked } } ) ;
62
+ }
63
+ } }
56
64
>
57
65
< input type = "checkbox" { ...props } disabled = { disabled || isReadOnly } />
58
66
< span className = { `pf3-switch-slider${ props . checked ? ' checked' : '' } ` } >
You can’t perform that action at this time.
0 commit comments