Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Commit

Permalink
Pass unstable_disclosureRef to Reakit's Menu
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Aug 13, 2020
1 parent 8b9e0e0 commit 9991398
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 98 deletions.
9 changes: 4 additions & 5 deletions packages/bumbag/src/Autosuggest/Autosuggest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Input, InputProps } from '../Input';
import {
DropdownMenu,
DropdownMenuPopover,
DropdownMenuDisclosure,
DropdownMenuButton,
DropdownMenuPopoverProps,
DropdownMenuItemProps,
DropdownMenuInitialState,
Expand Down Expand Up @@ -252,7 +252,7 @@ const useProps = createHook<AutosuggestProps>(
gutter: 4,
...dropdownMenuInitialState,
});
const dropdownMenuDisclosureProps = DropdownMenuDisclosure.useProps(dropdownMenu);
const dropdownMenuButtonProps = DropdownMenuButton.useProps(dropdownMenu);

//////////////////////////////////////////////////

Expand Down Expand Up @@ -584,21 +584,20 @@ const useProps = createHook<AutosuggestProps>(

return {
...boxProps,
'aria-expanded': dropdownMenuDisclosureProps['aria-expanded'],
'aria-expanded': dropdownMenuButtonProps['aria-expanded'],
'aria-haspopup': 'listbox',
'aria-owns': dropdownMenu.baseId,
role: 'combobox',
className,
children: (
<AutosuggestContext.Provider value={context}>
<Input
{...omit(dropdownMenuDisclosureProps, 'type', 'className', 'role')}
{...omit(dropdownMenuButtonProps, 'type', 'className', 'role')}
after={inputValue && <ClearButton onClick={handleClear} buttonProps={clearButtonProps} />}
aria-autocomplete="list"
aria-activedescendant={dropdownMenu?.items?.[highlightedIndex]?.id}
className={inputClassName}
disabled={disabled}
elementRef={dropdownMenuDisclosureProps.ref}
isLoading={isInputLoading}
onBlur={handleBlurInput}
onClick={handleClickInput}
Expand Down
90 changes: 0 additions & 90 deletions packages/bumbag/src/DropdownMenu/DropdownMenuDisclosure.tsx

This file was deleted.

2 changes: 2 additions & 0 deletions packages/bumbag/src/DropdownMenu/DropdownMenuPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const useProps = createHook<DropdownMenuPopoverProps>(
items,
setCurrentId,
wrap,
unstable_disclosureRef,
unstable_initialFocusRef,
unstable_finalFocusRef,
unstable_popoverRef,
Expand Down Expand Up @@ -65,6 +66,7 @@ const useProps = createHook<DropdownMenuPopoverProps>(
items,
setCurrentId,
wrap,
unstable_disclosureRef,
unstable_initialFocusRef,
unstable_finalFocusRef,
unstable_popoverRef,
Expand Down
3 changes: 0 additions & 3 deletions packages/bumbag/src/DropdownMenu/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,20 @@ import { DropdownMenu as _DropdownMenu } from './DropdownMenu';
import { DropdownMenuPopover } from './DropdownMenuPopover';
import { DropdownMenuItem } from './DropdownMenuItem';
import { DropdownMenuButton } from './DropdownMenuButton';
import { DropdownMenuDisclosure } from './DropdownMenuDisclosure';
import { DropdownMenuDivider } from './DropdownMenuDivider';
import { DropdownMenuGroup } from './DropdownMenuGroup';
import { useDropdownMenuState, DropdownMenuState } from './DropdownMenuState';

export * from './DropdownMenu';
export * from './DropdownMenuItem';
export * from './DropdownMenuButton';
export * from './DropdownMenuDisclosure';
export * from './DropdownMenuPopover';
export * from './DropdownMenuGroup';
export * from './DropdownMenuDivider';
export * from './DropdownMenuState';
export const DropdownMenu = Object.assign(_DropdownMenu, {
Popover: DropdownMenuPopover,
Button: DropdownMenuButton,
Disclosure: DropdownMenuDisclosure,
Item: DropdownMenuItem,
Divider: DropdownMenuDivider,
Group: DropdownMenuGroup,
Expand Down

0 comments on commit 9991398

Please sign in to comment.