Skip to content

Commit

Permalink
fix(check-in): adds functionality to auto select the input text for <…
Browse files Browse the repository at this point in the history
…InlineValuePopover />
  • Loading branch information
kirtesh-xola committed Jun 17, 2024
1 parent 97ec259 commit b1ce429
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/components/Forms/InlineValuePopover.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const InlineValuePopover = ({
text,
isOpen = false,
showArrow = true,
autoSelectOnClick = false,
onClick,
onClickOutside,
classNames,
Expand All @@ -20,7 +21,14 @@ export const InlineValuePopover = ({
setTimeout(() => {
// This may technically belong in Seller app, but the most common use case for this component here is
// to use inputs, so we'll provide some helpers for that
ref?.current.querySelector("select,textarea,input")?.focus();
const popoverInput = ref?.current.querySelector("select,textarea,input");
if (!popoverInput) return;

popoverInput.focus();

if (autoSelectOnClick) {
popoverInput.select();
}
}, 0);
onClick?.(e);
};
Expand Down

0 comments on commit b1ce429

Please sign in to comment.