@@ -295,6 +295,9 @@ const BaseVisualContainer = styled.div<{variant?: ItemProps['variant']; disabled
295295 height: 20px;
296296 width: ${ get ( 'space.3' ) } ;
297297 margin-right: ${ get ( 'space.2' ) } ;
298+ display: flex;
299+ justify-content: center;
300+ align-items: center;
298301`
299302
300303const ColoredVisualContainer = styled ( BaseVisualContainer ) `
@@ -333,8 +336,16 @@ const DescriptionContainer = styled.span`
333336 flex-basis: var(--description-container-flex-basis);
334337`
335338
336- const MultiSelectInput = styled . input `
337- pointer-events: none;
339+ const MultiSelectIcon = styled . svg < { selected ?: boolean } > `
340+ rect {
341+ fill: ${ ( { selected} ) => ( selected ? get ( 'colors.accent.fg' ) : get ( 'colors.canvas.default' ) ) } ;
342+ stroke: ${ ( { selected} ) => ( selected ? get ( 'colors.accent.fg' ) : get ( 'colors.border.default' ) ) } ;
343+ }
344+ path {
345+ fill: ${ get ( 'colors.fg.onEmphasis' ) } ;
346+ boxshadow: ${ get ( 'shadow.small' ) } ;
347+ opacity: ${ ( { selected} ) => ( selected ? 1 : 0 ) } ;
348+ }
338349`
339350
340351/**
@@ -372,11 +383,6 @@ export const Item = React.forwardRef((itemProps, ref) => {
372383 return
373384 }
374385 onKeyPress ?.( event )
375- const isCheckbox = event . target instanceof HTMLInputElement && event . target . type === 'checkbox'
376- if ( isCheckbox && event . key === ' ' ) {
377- // space key on a checkbox will also trigger a click event. Ignore the space key so we don't get double events
378- return
379- }
380386
381387 if ( ! event . defaultPrevented && [ ' ' , 'Enter' ] . includes ( event . key ) ) {
382388 onAction ?.( itemProps , event )
@@ -425,19 +431,26 @@ export const Item = React.forwardRef((itemProps, ref) => {
425431 < BaseVisualContainer >
426432 { selectionVariant === 'multiple' ? (
427433 < >
428- { /*
429- * readOnly is required because we are doing a one-way bind to `checked`.
430- * aria-readonly="false" tells screen that they can still interact with the checkbox
434+ { /**
435+ * we use a svg instead of an input because there should not
436+ * be an interactive element inside an option
437+ * svg copied from primer/css
431438 */ }
432- < MultiSelectInput
433- disabled = { disabled }
434- tabIndex = { - 1 }
435- type = "checkbox"
436- checked = { selected }
437- aria-label = { text }
438- readOnly
439- aria-readonly = "false"
440- />
439+ < MultiSelectIcon
440+ selected = { selected }
441+ width = "16"
442+ height = "16"
443+ viewBox = "0 0 16 16"
444+ xmlns = "http://www.w3.org/2000/svg"
445+ aria-hidden = "true"
446+ >
447+ < rect x = "2" y = "2" width = "12" height = "12" rx = "4" > </ rect >
448+ < path
449+ fillRule = "evenodd"
450+ strokeWidth = "0"
451+ d = "M4.03231 8.69862C3.84775 8.20646 4.49385 7.77554 4.95539 7.77554C5.41693 7.77554 6.80154 9.85246 6.80154 9.85246C6.80154 9.85246 10.2631 4.314 10.4938 4.08323C10.7246 3.85246 11.8785 4.08323 11.4169 5.00631C11.0081 5.82388 7.26308 11.4678 7.26308 11.4678C7.26308 11.4678 6.80154 12.1602 6.34 11.4678C5.87846 10.7755 4.21687 9.19077 4.03231 8.69862Z"
452+ />
453+ </ MultiSelectIcon >
441454 </ >
442455 ) : (
443456 selected && < CheckIcon fill = { theme ?. colors . fg . default } />
0 commit comments