-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make dropdown menu accessible (#2627)
- Loading branch information
1 parent
f0925e2
commit 44e6c98
Showing
10 changed files
with
130 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
export * from './button'; | ||
export * from './button-group'; | ||
export * from './dialog'; | ||
export * from './dropdown'; | ||
export * from './menu'; | ||
export * from './markdown'; | ||
export * from './spinner'; | ||
export * from './tabs'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
@import url('@reach/menu-button/styles.css'); | ||
|
||
[data-reach-menu-list] { | ||
background-color: var(--color-neutral-0); | ||
box-shadow: var(--box-shadow); | ||
border: none; | ||
border-radius: var(--border-radius-8); | ||
font-size: inherit; | ||
max-width: 250px; | ||
padding: var(--px-4); | ||
} | ||
|
||
[data-reach-menu-item] { | ||
border-radius: var(--border-radius-4); | ||
font-size: inherit; | ||
margin: var(--px-4); | ||
overflow: hidden; | ||
padding: var(--px-6) var(--px-8); | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
|
||
&[data-selected], | ||
&:hover { | ||
background-color: var(--color-neutral-7); | ||
color: inherit; | ||
} | ||
|
||
&:not(:first-child) { | ||
margin-top: 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { | ||
Menu as MenuRoot, | ||
MenuButton, | ||
MenuItem, | ||
MenuList, | ||
} from '@reach/menu-button'; | ||
import { createComponentGroup } from '../utility/component-group'; | ||
|
||
import './menu.css'; | ||
|
||
export const Menu = createComponentGroup(MenuRoot, { | ||
Button: MenuButton, | ||
Item: MenuItem, | ||
List: MenuList, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { JSXElementConstructor } from 'react'; | ||
|
||
export const createComponentGroup = < | ||
Root extends JSXElementConstructor<any>, | ||
Children extends { [key: string]: JSXElementConstructor<any> }, | ||
>( | ||
root: Root, | ||
children: Children, | ||
): Root & Children => | ||
Object.entries(children).reduce<any>((r, [key, value]) => { | ||
r[key] = value; | ||
return r; | ||
}, root); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4469,6 +4469,29 @@ | |
react-remove-scroll "^2.4.3" | ||
tslib "^2.3.0" | ||
|
||
"@reach/[email protected]": | ||
version "0.17.0" | ||
resolved "https://registry.yarnpkg.com/@reach/dropdown/-/dropdown-0.17.0.tgz#8140bb2e6a045f91e07c6d5a6ff960958df2ef33" | ||
integrity sha512-qBTIGInhxtPHtdj4Pl2XZgZMz3e37liydh0xR3qc48syu7g71sL4nqyKjOzThykyfhA3Pb3/wFgsFJKGTSdaig== | ||
dependencies: | ||
"@reach/auto-id" "0.17.0" | ||
"@reach/descendants" "0.17.0" | ||
"@reach/popover" "0.17.0" | ||
"@reach/utils" "0.17.0" | ||
tslib "^2.3.0" | ||
|
||
"@reach/menu-button@^0.17.0": | ||
version "0.17.0" | ||
resolved "https://registry.yarnpkg.com/@reach/menu-button/-/menu-button-0.17.0.tgz#9f40979129b61f8bdc19590c527f7ed4883d2dce" | ||
integrity sha512-YyuYVyMZKamPtivoEI6D0UEILYH3qZtg4kJzEAuzPmoR/aHN66NZO75Fx0gtjG1S6fZfbiARaCOZJC0VEiDOtQ== | ||
dependencies: | ||
"@reach/dropdown" "0.17.0" | ||
"@reach/popover" "0.17.0" | ||
"@reach/utils" "0.17.0" | ||
prop-types "^15.7.2" | ||
tiny-warning "^1.0.3" | ||
tslib "^2.3.0" | ||
|
||
"@reach/[email protected]": | ||
version "1.2.0" | ||
resolved "https://registry.yarnpkg.com/@reach/observe-rect/-/observe-rect-1.2.0.tgz#d7a6013b8aafcc64c778a0ccb83355a11204d3b2" | ||
|