Skip to content

Commit

Permalink
add fn
Browse files Browse the repository at this point in the history
  • Loading branch information
vashjs committed Oct 22, 2024
1 parent dd9cf5b commit 19ad5fe
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/RepeatableField/RepeatableField.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const RepeatableField = ({
const fieldsLength = fields.length;
const isSomeChildElementFocused = useIsElementFocused(rootRef);
const focusedIndex = useFocusedIndex(fieldsLength);
const hasToBeFocused = (index) => isSomeChildElementFocused && focusedIndex === index;

return (
<fieldset
Expand Down Expand Up @@ -84,7 +85,7 @@ const RepeatableField = ({
>
<RepeatableFieldContent
rootRef={rootRef}
isFocused={(focusedIndex === index) && isSomeChildElementFocused}
isFocused={hasToBeFocused(index)}
>
{renderField(field, index, fields)}
</RepeatableFieldContent>
Expand Down

0 comments on commit 19ad5fe

Please sign in to comment.