Skip to content

Commit

Permalink
FormTokenField: Add Help Text (#15469)
Browse files Browse the repository at this point in the history
* add visual help text

* updates based on review

* add periods after help msgs
  • Loading branch information
marekhrabe authored May 16, 2019
1 parent a95d5de commit b193b09
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 6 additions & 3 deletions packages/components/src/form-token-field/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -583,9 +583,12 @@ class FormTokenField extends Component {
/>
) }
</div>
<div id={ `components-form-token-suggestions-howto-${ instanceId }` } className="screen-reader-text">
{ __( 'Separate with commas' ) }
</div>
<p id={ `components-form-token-suggestions-howto-${ instanceId }` } className="components-form-token-field__help">
{ this.props.tokenizeOnSpace ?
__( 'Separate with commas, spaces, or the Enter key.' ) :
__( 'Separate with commas or the Enter key.' )
}
</p>
</div>
);
/* eslint-enable jsx-a11y/no-static-element-interactions */
Expand Down
6 changes: 5 additions & 1 deletion packages/components/src/form-token-field/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
flex-wrap: wrap;
align-items: flex-start;
width: 100%;
margin: 0;
margin: 0 0 $grid-size 0;
padding: $grid-size-small;
background-color: $white;
border: $border-width solid $light-gray-700;
Expand Down Expand Up @@ -50,6 +50,10 @@
margin-bottom: $grid-size-small;
}

.components-form-token-field__help {
font-style: italic;
}

// Tokens
.components-form-token-field__token {
font-size: $default-font-size;
Expand Down

0 comments on commit b193b09

Please sign in to comment.