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

Commit

Permalink
used buttonNode for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
Silviu Avram committed Jan 4, 2019
1 parent 96a61ab commit 97758c2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/components/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ export default class Dropdown extends AutoControlledComponent<
Extendable<DropdownProps>,
DropdownState
> {
private buttonNode: HTMLElement
private inputNode: HTMLElement
private listNode: HTMLElement
private buttonRef = React.createRef<HTMLElement>()

static displayName = 'Dropdown'

Expand Down Expand Up @@ -289,7 +289,11 @@ export default class Dropdown extends AutoControlledComponent<
const content = value && !multiple ? itemToString(value) : placeholder

return (
<Ref innerRef={this.buttonRef}>
<Ref
innerRef={(buttonNode: HTMLElement) => {
this.buttonNode = buttonNode
}}
>
<Button
content={content}
fluid
Expand Down Expand Up @@ -664,7 +668,7 @@ export default class Dropdown extends AutoControlledComponent<
return
case keyboardKey.Escape:
accessibilityInputPropsKeyDown(e)
this.buttonRef.current.focus()
this.buttonNode.focus()
return
default:
accessibilityInputPropsKeyDown(e)
Expand All @@ -684,7 +688,7 @@ export default class Dropdown extends AutoControlledComponent<
this.setA11yStatus(getA11ySelectionMessage.onAdd(item))
}
if (!search) {
this.buttonRef.current.focus()
this.buttonNode.focus()
}

// we don't have event for it, but want to keep the event handling interface, event is empty.
Expand Down

0 comments on commit 97758c2

Please sign in to comment.