From 76c02016a2a5fc2a40ec1b00c7a2d8ab996b300e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aappo=20=C3=85lander?= Date: Tue, 25 May 2021 16:15:09 +0300 Subject: [PATCH] Fix Dropdown linting error. --- src/core/Dropdown/Dropdown/Dropdown.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/core/Dropdown/Dropdown/Dropdown.tsx b/src/core/Dropdown/Dropdown/Dropdown.tsx index 6cabd7790..d6bd1f676 100644 --- a/src/core/Dropdown/Dropdown/Dropdown.tsx +++ b/src/core/Dropdown/Dropdown/Dropdown.tsx @@ -98,6 +98,13 @@ class BaseDropdown extends Component { : undefined, }; + buttonRef: React.RefObject; + + constructor(props: DropdownProps & InnerRef) { + super(props); + this.buttonRef = React.createRef(); + } + static getDerivedStateFromProps( nextProps: DropdownProps, prevState: DropdownState, @@ -190,6 +197,7 @@ class BaseDropdown extends Component { value={selectedValue || ''} > { { + if (event.code === 'Tab' && !!this.buttonRef.current) { + event.preventDefault(); + this.buttonRef.current.focus(); + } + }} > {children}