Skip to content

Commit

Permalink
Merge pull request #1843 from adevinta/fix-item-indicator-safari
Browse files Browse the repository at this point in the history
fix(dropdown): fixed missing ItemIndicator on Safari
  • Loading branch information
Powerplex authored Jan 29, 2024
2 parents 7fed9d3 + dd1dd6d commit ccf6b17
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions packages/components/dropdown/src/DropdownItemIndicator.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Icon } from '@spark-ui/icon'
import { Check } from '@spark-ui/icons/dist/icons/Check'
import { cx } from 'class-variance-authority'
import { forwardRef, ReactNode, type Ref } from 'react'

import { useDropdownContext } from './DropdownContext'
import { useDropdownItemContext } from './DropdownItemContext'

export interface ItemIndicatorProps {
Expand All @@ -14,9 +14,12 @@ export interface ItemIndicatorProps {
export const ItemIndicator = forwardRef(
({ className, children, label }: ItemIndicatorProps, forwardedRef: Ref<HTMLSpanElement>) => {
const { disabled, isSelected } = useDropdownItemContext()
const { multiple } = useDropdownContext()
const childElement =
children || (multiple ? <Check aria-label={label} /> : <span aria-label={label}></span>)

const childElement = children || (
<Icon size="sm">
<Check aria-label={label} />
</Icon>
)

return (
<span
Expand Down

0 comments on commit ccf6b17

Please sign in to comment.