-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Custom attributes for <EditableText /> underlying textarea #7333
base: develop
Are you sure you want to change the base?
Custom attributes for <EditableText /> underlying textarea #7333
Conversation
Thanks for your interest in palantir/blueprint, @rallelind! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request. |
I did sign this, but it does not seem like the PR updated. Do i need to do anything? |
* `multiline={true}`. This allows you to specify additional attributes like | ||
* `aria-` attributes, `data-` attributes, etc. | ||
*/ | ||
customTextareaAttributes?: { |
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.
I think it's plausible that a consumer of this component might want to add custom attributes even when the component isn't multiline. Could we extend this prop to cover both cases? Something like:
customTextareaAttributes?: { | |
customInputAttributes?: { |
return multiline ? (
<textarea ref={this.refHandlers.input} {...props} {...customInputAttributes} />
) : (
<input ref={this.refHandlers.input} type={type} {...props} {...customInputAttributes} />
);
We should also consider limiting the scope of attributes we can pass to just those of textarea and input elements:
type HTMLInputProps = React.InputHTMLAttributes<HTMLInputElement>;
type HTMLTextAreaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement>;
{ customInputAttributes?: HTMLInputProps & HTMLTextAreaProps; }
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.
Makes perfect sense! I should have updated the tests and the prop to allow for this. Thanks for reviewing!
The PR is updated with the CLA check. You're all good! |
…put, aswell as limiting the attributes to the TextArea and Input props
Fixes #6916
Checklist
Changes proposed in this pull request:
Reviewers should focus on:
I added the ability to pass custom attributes to the underlying text area element. It was not clear to me if this should also be added for the underlying input and if so should that have a seperate prop? Or would we just use the same prop for the two.
Furthermore, this is the first time i try contributing to an open source project, would love feedback if any!
Screenshot