Skip to content

Commit

Permalink
refactor: variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
haxxmaxx committed Jun 23, 2022
1 parent 59cc434 commit 5fec65f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apis/nucleus/src/components/listbox/useConfirmUnfocus.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useRef, useEffect, useState } from 'react';
* user interact outside of passed element ref.
*/

export default function useConfirmUnfocus(ref, selections, enabledConfirmOnBlur) {
export default function useConfirmUnfocus(ref, selections, shouldConfirmOnBlur) {
const [_isConfirmed, _setIsConfirmed] = useState(false);
// Wrap state in ref to use inside eventListener callback
const isConfirmedRef = useRef(_isConfirmed);
Expand All @@ -15,7 +15,7 @@ export default function useConfirmUnfocus(ref, selections, enabledConfirmOnBlur)
};

useEffect(() => {
if (!enabledConfirmOnBlur) return () => {};
if (!shouldConfirmOnBlur) return () => {};

const handleEvent = (event) => {
const interactInside = ref.current && ref.current.contains(event.target);
Expand All @@ -34,5 +34,5 @@ export default function useConfirmUnfocus(ref, selections, enabledConfirmOnBlur)
document.removeEventListener('mousedown', handleEvent);
document.removeEventListener('keydown', handleEvent);
};
}, [ref, selections, enabledConfirmOnBlur]);
}, [ref, selections, shouldConfirmOnBlur]);
}

0 comments on commit 5fec65f

Please sign in to comment.