-
Notifications
You must be signed in to change notification settings - Fork 166
[terra-form-input][terra-form-textarea] Remove prop placeholder #3075
Changes from 16 commits
16a4113
1928ceb
49aacf9
58346bf
895b581
9241997
59fde03
5a472c7
f132725
c212ae8
cac5390
81fdeaf
08617ed
11d9810
ad81efd
dc8a375
6c6adda
cc227eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,10 +75,6 @@ const propTypes = { | |
* Function to trigger when user changes the input value. Provide a function to create a controlled input. | ||
*/ | ||
onChange: PropTypes.func, | ||
/** | ||
* Placeholder text. | ||
*/ | ||
placeholder: PropTypes.string, | ||
/** | ||
* Ref callback to pass into the ref attribute of the html input element. | ||
*/ | ||
|
@@ -118,7 +114,6 @@ const defaultProps = { | |
isLabelHidden: false, | ||
labelAttrs: {}, | ||
onChange: undefined, | ||
placeholder: undefined, | ||
maxWidth: undefined, | ||
refCallback: undefined, | ||
required: false, | ||
|
@@ -145,7 +140,6 @@ const InputField = (props) => { | |
labelAttrs, | ||
maxWidth, | ||
onChange, | ||
placeholder, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should placeholder also be deleted from the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update here ad81efd. |
||
refCallback, | ||
required, | ||
showOptional, | ||
|
@@ -170,6 +164,10 @@ const InputField = (props) => { | |
|
||
const inputType = type || inputAttrs.type; | ||
|
||
if (customProps.placeholder) { | ||
customProps.placeholder = null; | ||
} | ||
|
||
return ( | ||
<Field | ||
label={label} | ||
|
@@ -194,7 +192,6 @@ const InputField = (props) => { | |
isIncomplete={isIncomplete} | ||
type={inputType} | ||
onChange={onChange} | ||
placeholder={placeholder || inputAttrs.placeholder} | ||
value={value} | ||
defaultValue={defaultValue} | ||
refCallback={refCallback} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The example is already using the There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
</Field> | ||
</div> | ||
); | ||
|
This file was deleted.
This file was deleted.
This file was deleted.
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: c212ae8There 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.