mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-20 23:12:13 +00:00
tabIndex override implemented
This commit is contained in:
parent
6d18c05771
commit
8f1a61d3cf
1 changed files with 3 additions and 2 deletions
|
|
@ -16,7 +16,7 @@ const TAG_NAMES_FOR_TYPE = {
|
||||||
search: 'input'
|
search: 'input'
|
||||||
};
|
};
|
||||||
|
|
||||||
const Input = React.forwardRef(({ type, children, ...props }, ref) => {
|
const Input = React.forwardRef(({ type, tabIndex, children, ...props }, ref) => {
|
||||||
const onKeyUp = React.useCallback((event) => {
|
const onKeyUp = React.useCallback((event) => {
|
||||||
if (typeof props.onKeyUp === 'function') {
|
if (typeof props.onKeyUp === 'function') {
|
||||||
props.onKeyUp(event);
|
props.onKeyUp(event);
|
||||||
|
|
@ -56,7 +56,7 @@ const Input = React.forwardRef(({ type, children, ...props }, ref) => {
|
||||||
...props,
|
...props,
|
||||||
ref: ref,
|
ref: ref,
|
||||||
type: tagName === 'input' ? type : null,
|
type: tagName === 'input' ? type : null,
|
||||||
tabIndex: focusable ? 0 : -1,
|
tabIndex: (isNaN(tabIndex) || tabIndex === null) ? (focusable ? 0 : -1) : tabIndex,
|
||||||
onKeyUp: onKeyUp,
|
onKeyUp: onKeyUp,
|
||||||
onDrag: onDrag,
|
onDrag: onDrag,
|
||||||
onMouseOut: onMouseOut
|
onMouseOut: onMouseOut
|
||||||
|
|
@ -69,6 +69,7 @@ Input.propTypes = {
|
||||||
...BUTTON_INPUT_TYPES,
|
...BUTTON_INPUT_TYPES,
|
||||||
...TEXT_INPUT_TYPES
|
...TEXT_INPUT_TYPES
|
||||||
]).isRequired,
|
]).isRequired,
|
||||||
|
tabIndex: PropTypes.number,
|
||||||
children: PropTypes.oneOfType([
|
children: PropTypes.oneOfType([
|
||||||
PropTypes.arrayOf(PropTypes.node),
|
PropTypes.arrayOf(PropTypes.node),
|
||||||
PropTypes.node
|
PropTypes.node
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue