mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-20 10:42:12 +00:00
Focusable component declared as forwardable ref
This commit is contained in:
parent
271d113ef1
commit
127949d126
1 changed files with 3 additions and 3 deletions
|
|
@ -1,12 +1,12 @@
|
|||
import React from 'react';
|
||||
import FocusableContext from './FocusableContext';
|
||||
|
||||
const Focusable = ({ children }) => {
|
||||
const Focusable = React.forwardRef(({ children, ...props }, ref) => {
|
||||
return (
|
||||
<FocusableContext.Consumer>
|
||||
{focusable => React.cloneElement(React.Children.only(children), { tabIndex: focusable ? 0 : -1 })}
|
||||
{focusable => React.cloneElement(React.Children.only(children), { ...props, ref, tabIndex: focusable ? 0 : -1 })}
|
||||
</FocusableContext.Consumer>
|
||||
);
|
||||
};
|
||||
});
|
||||
|
||||
export default Focusable;
|
||||
|
|
|
|||
Loading…
Reference in a new issue