Skip to content

Commit

Permalink
fix(@clayui/shared): fixes error when getting stuck in an input maske…
Browse files Browse the repository at this point in the history
…d as hidden

Just checking if the input has a `tabIndex` and if it is greater than the minimum, otherwise we want to ignore it from the focus but if it doesn't have `tabIndex` we keep the default behavior, this is to cover the use case when an `input` has a `type=hidden` behavior but does not necessarily use `hidden` as the ClayColorPicker component use case.
  • Loading branch information
matuzalemsteles committed Jul 22, 2021
1 parent f4d8aa0 commit 4c0c5cb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/clay-shared/src/useFocusManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ export function isFocusable({
}

if (tagName === 'input') {
return type !== 'file' && type !== 'hidden';
return (
type !== 'file' &&
type !== 'hidden' &&
(tabIndex != null ? tabIndex >= minTabIndex : true)
);
}

return (
Expand Down

0 comments on commit 4c0c5cb

Please sign in to comment.