-
Notifications
You must be signed in to change notification settings - Fork 166
[terra-search-field] Removed the terra-form-input and replaced it with a native input #3078
Conversation
@pranav300 I'm confused, why do we need to replace terra-form-input with native input to fix the placeholder issue? Don't we need to filter out and remove the placeholder prop from being passed down to the terra-form-input? Also, is this PR ready for review? Looking at this issue, there are UX TO DOs for terra-seach-field: #2992 (comment) |
@emilyrohrbough This PR is not ready for review, I had raised it so that we can validate the approach. |
This PR is not ready for review, can we move this to draft mode? and/or add a no not merge label on this PR. There was nothing in the summary to indicate this wan't ready for review. Since this isn't ready, who is suppose to be validating this? Could that person have looked at the branch diff? |
[dir=rtl] & { | ||
box-shadow: var(--terra-search-field-input-focus-rtl-box-shadow); | ||
} | ||
} |
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.
We should reduce these styles/variables as much as possible and apply only the ones necessary for theming the search field appropriately. Are all terra-form-input variables required to theme the search field?
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.
Are all terra-form-input variables required to theme the search field?
I had imported only the ones that were used by search-field when it imported form-input.
But still, I have gone through the CSS and removed some variables which I think were unnecessary here 468041b.
width: 100%; | ||
|
||
&::placeholder { | ||
color: var(--terra-search-field-input-placeholder-color, rgba(25, 32, 35, 0.53)); |
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.
Looks like this is the same placeholder color that was used in form-input. Wouldn't this continue to have the insufficient color contrast with the background that we originally had in form-input?
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.
Updated here 7c7364d.
aria-disabled={isDisabled} | ||
onKeyDown={this.handleKeyDown} | ||
onInput={this.handleInput} | ||
refCallback={this.setInputRef} | ||
ref={this.setInputRef} | ||
{...additionalInputAttributes} |
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.
Previously, form-input will automatically add aria-required
if required
was passed to inputAttributes
. Since this is no longer leveraging form-input, it would lose this logic. Should this be added here?
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 and @neilpfeiffer discussed this and decided that it is unneeded to make search-field
a required field.
aria-disabled={isDisabled} | ||
onKeyDown={this.handleKeyDown} | ||
onInput={this.handleInput} | ||
refCallback={this.setInputRef} | ||
ref={this.setInputRef} | ||
{...additionalInputAttributes} |
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.
It maybe not be part of this scope, but in general we spread pass-through attributes before our implementation specific ones so the behaviors cannot be overridden. So I'd like to see this moved.
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.
Thanks @dkasper-was-taken - logged this new issue here to move the spread to first in the list: #3086
Tested: PR #3078 Reviewed:
|
Summary
This PR removes the use of
terra-form-input
from the search-field and replaces it withnative input
.All the styles necessary for the input are taken directly from
terra-form-input
.This is done to support placeholder in search-field after PR #3075 has been merged, which removes placeholder from the form-input and form-textarea.
Part of #2992
Deployment Link
https://terra-core-search-field-asffbr.herokuapp.com/components/terra-search-field/search-field/search-field
Testing
Additional Details
Thank you for contributing to Terra.
@cerner/terra