Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(react-input): allow ref to be forwarded to component #1803

Merged
merged 1 commit into from
Sep 26, 2023

Conversation

ju-Skinner
Copy link
Collaborator

@ju-Skinner ju-Skinner commented Sep 26, 2023

Description

In a support request, it was discovered the ref was not working as expected. This solves the issue now.

Implemenation example.

import { Input } from '@kajabi/sage-react'

const inputRef = React.useRef(null);

React.useEffect(() => {
  if (inputRef.current) {
    inputRef.current.focus();
  }
}, []);

return (
  <Input onFocus={onFocus} ref={inputRef} />
);

Video Reference: Hopefully the audio was recorded.
https://www.loom.com/share/6ceb6bb9b0284072b147a5c442e09191

Testing in sage-lib

  1. You can load storybook locally and navigate to http://localhost:4100/?path=/story/sage-input--input-focus-test
  2. Result...input should be focused. Clicking off it will show the placeholder text.

@ju-Skinner ju-Skinner marked this pull request as ready for review September 26, 2023 18:54
@ju-Skinner ju-Skinner self-assigned this Sep 26, 2023
@ju-Skinner ju-Skinner requested review from a team and safa-kajabi September 26, 2023 18:55
Copy link

@safa-kajabi safa-kajabi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! -- Approved!

Copy link
Member

@pixelflips pixelflips left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks so much for jumping on this one!

@pixelflips pixelflips requested a review from a team September 26, 2023 18:59
@ju-Skinner ju-Skinner merged commit 619b942 into develop Sep 26, 2023
@ju-Skinner ju-Skinner deleted the fix/allow-forwardRef-to-react-input branch September 26, 2023 21:48
@ju-Skinner ju-Skinner mentioned this pull request Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants