-
Notifications
You must be signed in to change notification settings - Fork 166
[terra-form-input][terra-form-textarea] Remove prop placeholder #3075
Conversation
if (attributes.placeholder) { | ||
attributes.placeholder = null; | ||
} |
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.
This is a more aggressive approach than we usually take. Generally we allow consumers to pass native attributes through the custom props even if they are not officially supported/listed on the documentation site. I think we'll need to document the input does not allow a placeholder (and why) since this is an explicit/strict detail. Otherwise we'll want to allow the placeholder to pass through as a custom prop, but not provide any first class API for it/log a warning if it is detected.
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 have added a Note
on the doc pages for the component not allowing placeholder: c212ae8
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.
@StephenEsser this is a special case where UX intentionally not only wants to discourage use of placeholders, but outright disallow it as an accessibility best practice so consumers aren't still reliant on using them, particularly if they don't have direct support from UX and able to get guidance. Documentation will be the best approach, I think as we continue to improve the docsite, having standout sections similar to Mozilla and W3C that calls out special details or best practice notes will be a good place to call this out.
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.
+1 to being heavy handed. Let's document that this is the UX requirement though and that a passed in placeholder will be dropped.
* Removed `placeholder` prop. | ||
|
||
### Changed | ||
* Updated UpgradeGuide |
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 provide more detail about what the change to the upgrade guide implies. What was updated/added/changed?
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.
Update here ad81efd.
@@ -5,7 +5,7 @@ import Input from 'terra-form-input'; | |||
const NumberInputExample = () => ( | |||
<div> | |||
<Field label="Numeric Input" htmlFor="numeric"> | |||
<Input name="number input" placeholder="Enter Digits" id="numeric" type="number" ariaLabel="Numeric Input" /> | |||
<Input name="number input" id="numeric" type="number" ariaLabel="Numeric 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.
The number example in input field was updated to provide help text when the placeholder was removed, we should probably to the same 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 don't think this will necessary as this may mislead users to use Input
and FormField
as separate components rather than directly consuming InputField
.
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 example is already using the FormField
component
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 Stephen, I made this new issue #3084 to remove the Fields as part of the raw examples for our text-input, so users do not get confused what they are seeing and testing on this page. The use of Field here is now duplicative, since these example originally did not have the example template housing it, which now provides its own title and descriptions.
As part of our best practice UX Audits, it was identified that UX would like to showcase the InputField
and other Field componsitions as the primary form components, and then either move or segment raw building block components, like the solo input element component, into a separate location. See: UX Audit: terra-form-input
@@ -24,6 +23,8 @@ import FormInputPropsTable from 'terra-form-input/src/Input?dev-site-props-table | |||
|
|||
Generic input which represents an HTML input element directly. | |||
|
|||
**Note:** To follow UX Best Practices, this component does not allow `placeholder`. |
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.
At some point we should have a writeup about why we made this decision and link out to it here (and anywhere else this note is written)
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.
Added link to w3 Placeholder Research in Note
section.
* `Input` component will not be supporting `placeholder` prop and `native placeholder`. If consumers want to provide a detailed text guidance they can upgrade to `InputField`. | ||
|
||
* `InputField` component will not be supporting `placeholder` prop and `native placeholder`. But consumers can provide a help text using the `help` prop. |
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 provide more guidance on what the upgrade entails for these sections.
If consumers want to provide a detailed text guidance they can upgrade to
InputField
.....
After switching to an InputField a consumer may utilize the help text field properties to provide similar guidance to the user. If we have any UX design standards/recommendations this may be a good place to mention a few of those details.
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.
Update here ad81efd.
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.
+1 on the code changes. I think adding some detailed documentation prior to releasing will help users transition and understand the changes.
@@ -145,7 +140,6 @@ const InputField = (props) => { | |||
labelAttrs, | |||
maxWidth, | |||
onChange, | |||
placeholder, |
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.
Should placeholder also be deleted from the customProps
just like in Input.jsx if we outright disallow it? Otherwise, it would get spread onto FormField.
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.
Update here ad81efd.
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 this'll be good to go once Ben's comment is addressed.
@@ -137,7 +132,6 @@ const TextareaField = (props) => { | |||
required, | |||
showOptional, | |||
onChange, | |||
placeholder, |
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.
Same as this comment: #3075 (comment)
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.
Update here ad81efd
Do not merge this PR until placeholder has been removed from search-field(PR #3078) |
Tested: PR #3075 Reviewed:
|
…ve-placeholder-from-input-and-textarea
Summary
This PR:
**
--terra-form-input-placeholder-color
**
--terra-form-input-placeholder-font-style
**
--terra-form-input-placeholder-disabled-color
**
--terra-form-input-placeholder-disabled-font-style
**
--terra-form-textarea-placeholder-color
**
--terra-form-textarea-placeholder-font-style
**
--terra-form-textarea-placeholder-disabled-color
**
--terra-form-textarea-placeholder-disabled-font-style
Closes #2992 along with #3078
Deployment Link
https://terra-core-deployed-pr-3075.herokuapp.com/
Testing
Additional Details
Thank you for contributing to Terra.
@cerner/terra