-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
feat(editable): add editable textarea element #4443
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
Conversation
🦋 Changeset detectedLatest commit: 230a9c3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/chakra-ui/chakra-ui-storybook/HdExSTCaswsUev2gWd2wCyoat2XJ |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 230a9c3:
|
This is a feature that we'd like to use. Is there anything holding this up? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hej @heozeop thanks for your Contribution.
Your code looks good to me in general, but it feels like we're mixing things up in this by making use-editable
work with HTMLInputElement
and HTMLTextAreaElement
i would rather make use-editable
generic and as well split up editable
into two components editable-input
and editable-textarea
which use the generic version of use-editable
with their respective Element
-Type.
Splitting this component into two would also clarify the props in the documentation since the Textarea
-props aren't displayed their although they could be used like this.
This is just my opinion, before doing any refactoring I would wait for one of the core members of the chakra team to give some input. @segunadebayo @with-heart @TimKolberger
I was wondering if there is a timeline for reviewing the PR with the new changes? It would be fantastic to be able to use this |
Hoping this feature will be merged and deployed soon - I would have immediate use for this on a current project for a client. Thank you @heozeop and @takethefake for your time and efforts put towards implementing this change! |
@takethefake @with-heart @TimKolberger I just resolved the error which is occurred during build/lint/test. It would be great if you leave some comments or merge the feature! Thanks! ContextFYI
Issue: attribute 'height' incompatibleWhile build/lint/test, github action throw the error below (error page).
Try: update type of editable input/textarea propsI thought that returns of 'editable hook' should focus on functionality of editable(well, there is So, I updated 'editable input and textarea props type' to I want your opinion about using
|
situation
Please share your opinionI think I have two options.
@takethefake @TimKolberger @with-heart Thanks! |
The lint errors on main are fixed for now 🎉 My personal preference is to rebase feature branches onto main to prevent big merge commits. This PR adds a great feature which I'd love to merge when it's ready. |
Thank you very much @TimKolberger! Thanks for your comment and commit, I'm really relieved. As you recommended, I rebased this branch onto Thank you again! |
Any chance we might see this merged soon? |
Hello! @TimKolberger @with-heart! Can you merge this PR or review the change? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good! I added a comment regarding the theme styles, my apologies to not catching this earlier.
Hello! @TimKolberger |
No worries 😊 |
To maintain consistency of editable context, use union type of textarea and input element to reference element.
To simplify usage and the type safety, add types where it declared.
The 'height' attribute type that html elemenet delivered is not compatable with 'height' of chakra. So, use PropGetterV2 to resolve style incompatiblity.
Hey @heozeop! I really appreciate the work you put into this 💖 Needless to say that this PR was open for far too long 😪 Kindly allow me to bring this over the finish line:
@all-contributors add @heozeop for code |
I've put up a pull request to add @heozeop! 🎉 |
I am not sure if something changed for using controlled value (React useState) of Editable for normal Input field.
Now setting a new value in useEffect doesnt seem to propagate into the "inner" value of Editable. |
Hi @kk21, Kindly open an issue with a reproduction in CodeSandbox. It is hard to verify an issue without actual code. I don't see any changes regarding the value handling in this PR, it is still using the useControllableState hook - a reproduction would help a lot. |
Opened an issue here |
Editable textarea element to handle multi-line input within editable context.
Closes #1622
📝 Description
🚀 New behavior
📝 Additional Information
Use union type for inputRef
Because the editable context has one controllable state as default,
use union type for input to maintain compatibility with the above condition.
split test suite for editable textarea
Despite of the similarity of
editable.test.tsx
andeditableTextarea.test.tsx
, which is the test file ineditable pakage
,I choose to split test suite to minimize lines of suite.