File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed
packages/ui/src/components/SelectableCard Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @ultraviolet/ui " : minor
3+ ---
4+
5+ ` SelectableCard ` : add "stopPropagation" in the children for keyboard events
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { Row } from '../../Row'
55import { SelectInput } from '../../SelectInput'
66import { Stack } from '../../Stack'
77import { Text } from '../../Text'
8+ import { TextArea } from '../../TextArea'
89import { SelectableCard } from '..'
910import fr from './assets/fr.svg'
1011import nl from './assets/nl.svg'
@@ -24,6 +25,9 @@ export const Examples: StoryFn = args => {
2425 'label-27' : false ,
2526 'label-28' : false ,
2627 } )
28+ const [ value5 , onChange5 ] = useState ( {
29+ 'label-29' : false ,
30+ } )
2731
2832 return (
2933 < Stack flex = { 1 } gap = { 8 } >
@@ -312,6 +316,21 @@ export const Examples: StoryFn = args => {
312316 value = "label-28"
313317 />
314318 </ Row >
319+ < SelectableCard
320+ { ...args }
321+ checked = { value5 [ 'label-29' ] }
322+ label = "With an input in the children"
323+ name = "label-29" // fixed: match the state key
324+ onChange = {
325+ event =>
326+ onChange5 ( { ...value5 , 'label-29' : event . currentTarget . checked } ) // fixed: spread value5
327+ }
328+ showTick
329+ type = "checkbox"
330+ value = "label-29" // fixed: match the state key
331+ >
332+ < TextArea label = "" onChange = { ( ) => { } } />
333+ </ SelectableCard >
315334 </ Stack >
316335 )
317336}
Original file line number Diff line number Diff line change @@ -313,6 +313,7 @@ export const SelectableCard = forwardRef(
313313 type === 'checkbox' && isComplexChildren
314314 }
315315 data-has-label = { ! ! label && showTick }
316+ onKeyDown = { event => event . stopPropagation ( ) }
316317 ref = { childrenRef }
317318 width = "100%"
318319 >
You can’t perform that action at this time.
0 commit comments