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

Commit 97758c2

Browse files
author
Silviu Avram
committed
used buttonNode for consistency
1 parent 96a61ab commit 97758c2

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/components/Dropdown/Dropdown.tsx

+8-4
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ export default class Dropdown extends AutoControlledComponent<
133133
Extendable<DropdownProps>,
134134
DropdownState
135135
> {
136+
private buttonNode: HTMLElement
136137
private inputNode: HTMLElement
137138
private listNode: HTMLElement
138-
private buttonRef = React.createRef<HTMLElement>()
139139

140140
static displayName = 'Dropdown'
141141

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

291291
return (
292-
<Ref innerRef={this.buttonRef}>
292+
<Ref
293+
innerRef={(buttonNode: HTMLElement) => {
294+
this.buttonNode = buttonNode
295+
}}
296+
>
293297
<Button
294298
content={content}
295299
fluid
@@ -664,7 +668,7 @@ export default class Dropdown extends AutoControlledComponent<
664668
return
665669
case keyboardKey.Escape:
666670
accessibilityInputPropsKeyDown(e)
667-
this.buttonRef.current.focus()
671+
this.buttonNode.focus()
668672
return
669673
default:
670674
accessibilityInputPropsKeyDown(e)
@@ -684,7 +688,7 @@ export default class Dropdown extends AutoControlledComponent<
684688
this.setA11yStatus(getA11ySelectionMessage.onAdd(item))
685689
}
686690
if (!search) {
687-
this.buttonRef.current.focus()
691+
this.buttonNode.focus()
688692
}
689693

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

0 commit comments

Comments
 (0)