Skip to content

Commit

Permalink
fix: dropdown focus issues
Browse files Browse the repository at this point in the history
  • Loading branch information
MildTomato committed Mar 4, 2022
1 parent 899ccf8 commit 5210319
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/components/Dropdown/Dropdown.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
IconLogOut,
IconChevronDown,
IconChevronRight,
IconHardDrive,
} from './../../index'
import Typography from '../Typography'

Expand Down Expand Up @@ -104,7 +105,7 @@ export const DefaultFull = (args: any) => {
</Dropdown.Item>,
]}
>
<Dropdown.TriggerItem>
<Dropdown.TriggerItem icon={<IconHardDrive />}>
Open sub menu{' '}
<Dropdown.RightSlot>
<IconChevronRight size={14} />
Expand All @@ -117,7 +118,7 @@ export const DefaultFull = (args: any) => {
</Dropdown.Item>,
]}
>
<Button as="span" type="secondary" iconRight={<IconChevronDown />}>
<Button as="span" type="default" iconRight={<IconChevronDown />}>
Click for dropdown
</Button>
</Dropdown>
Expand Down
6 changes: 2 additions & 4 deletions src/components/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ function Dropdown({
return (
<RadixDropdown.Root onOpenChange={onOpenChange} open={open}>
{isNested ? (
<RadixDropdown.TriggerItem
className={[__styles.item, __styles.item_nested].join(' ')}
>
<RadixDropdown.TriggerItem className={[__styles.item_nested].join(' ')}>
{children}
</RadixDropdown.TriggerItem>
) : (
Expand Down Expand Up @@ -118,7 +116,7 @@ export function Item({
export function TriggerItem({ children, icon, disabled }: ItemProps) {
let __styles = styleHandler('dropdown')
return (
<div className={__styles.trigger}>
<div className={__styles.item}>
{icon && icon}
<span>{children}</span>
</div>
Expand Down
11 changes: 9 additions & 2 deletions src/lib/theme/defaultTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1166,16 +1166,23 @@ export default {
dropdown: {
// root:
trigger: `
flex
border-none
rounded
bg-transparent p-0
data-open:ring-2
data-open:ring-scale-900
outline-none
outline-offset-1
transition-all
focus:outline-4
focus:outline-brand-700
`,
item_nested: `
border-none
data-open:bg-scale-300 dark:data-open:bg-scale-500
data-open:text-scale-1200
focus:outline-none
focus:text-scale-1200
`,
content: `
bg-scale-100 dark:bg-scale-300
Expand Down

0 comments on commit 5210319

Please sign in to comment.