-
Notifications
You must be signed in to change notification settings - Fork 355
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Select-next,Dropdown-next): updated logic for keyboard interaction (
#8496) * fix(Select-next,Dropdown-next): updated logic for keyboard interaction * Added prop to apply a11y attributes * Fixed a11y errors * Updated new props * Removed selectVariant from examples * Updated prop name, added example verbiage
- Loading branch information
1 parent
2385b96
commit 0a343ce
Showing
12 changed files
with
93 additions
and
55 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 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,21 +1,36 @@ | ||
import * as React from 'react'; | ||
import styles from '@patternfly/react-styles/css/components/Menu/menu'; | ||
import { css } from '@patternfly/react-styles'; | ||
import { MenuContext } from './MenuContext'; | ||
|
||
export interface MenuListProps extends React.HTMLProps<HTMLUListElement> { | ||
/** Anything that can be rendered inside of menu list */ | ||
children: React.ReactNode; | ||
/** Additional classes added to the menu list */ | ||
className?: string; | ||
/** @beta Indicates to assistive technologies whether more than one item can be selected | ||
* for a non-checkbox menu. Only applies when the menu's role is "listbox". | ||
*/ | ||
isAriaMultiselectable?: boolean; | ||
} | ||
|
||
export const MenuList: React.FunctionComponent<MenuListProps> = ({ | ||
children = null, | ||
className, | ||
isAriaMultiselectable = false, | ||
...props | ||
}: MenuListProps) => ( | ||
<ul role="menu" className={css(styles.menuList, className)} {...props}> | ||
{children} | ||
</ul> | ||
); | ||
}: MenuListProps) => { | ||
const { role } = React.useContext(MenuContext); | ||
|
||
return ( | ||
<ul | ||
role={role} | ||
{...(role === 'listbox' && { 'aria-multiselectable': isAriaMultiselectable })} | ||
className={css(styles.menuList, className)} | ||
{...props} | ||
> | ||
{children} | ||
</ul> | ||
); | ||
}; | ||
MenuList.displayName = '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
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 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
Oops, something went wrong.