Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit 390999a

Browse files
author
Silviu Avram
committed
apply tabIndex only if dropdown is non-search
1 parent 40744a7 commit 390999a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/components/Dropdown/Dropdown.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,9 @@ export default class Dropdown extends AutoControlledComponent<
374374
getInputProps: (options?: GetInputPropsOptions) => any,
375375
) {
376376
const accessibilityMenuProps = getMenuProps({ refKey: 'innerRef' }, { suppressRefError: true })
377+
const { search } = this.props
377378
// If it's just a selection, some attributes and listeners from Downshift input need to go on the menu list.
378-
if (!this.props.search) {
379+
if (!search) {
379380
const accessibilityInputProps = getInputProps()
380381
accessibilityMenuProps['aria-activedescendant'] =
381382
accessibilityInputProps['aria-activedescendant']
@@ -400,7 +401,7 @@ export default class Dropdown extends AutoControlledComponent<
400401
<List
401402
{...accessibilityMenuPropsRest}
402403
styles={styles.list}
403-
tabIndex={-1}
404+
tabIndex={search ? undefined : -1} // needs to be focused when trigger button is activated.
404405
aria-hidden={!isOpen}
405406
items={isOpen ? this.renderItems(styles, variables, getItemProps, highlightedIndex) : []}
406407
/>

0 commit comments

Comments
 (0)