Skip to content
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

FormTokenField: Add Help Text #15469

Merged
merged 3 commits into from May 16, 2019
Merged

FormTokenField: Add Help Text #15469

merged 3 commits into from May 16, 2019

Conversation

marekhrabe
Copy link
Contributor

@marekhrabe marekhrabe commented May 6, 2019

Description

Fixes #15355

I've made the message visible and added the mention of the enter key. It's styled to look the same way as other help texts in the sidebar.

The component allows developers to opt-in for using spacebar as a separator too. I've reflected that and made two versions of the help text based on the configuration.

How has this been tested?

  • New Post
  • In the sidebar, open "Tags" Panel and explore the new message

The sidebar term selector (Tags, Categories) is the only place where this component is used in core.

Screenshots

Standard Usage With Spacebar Separator Enabled
Screenshot 2019-05-06 at 17 49 59 Screenshot 2019-05-06 at 17 51 16

@marekhrabe marekhrabe added [Type] Enhancement A suggestion for improvement. [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). labels May 6, 2019
@marekhrabe marekhrabe requested a review from afercia May 6, 2019 16:03
margin-bottom: $grid-size-small;
}

.components-form-token-field__help {
display: block;
font-style: italic;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to have some design feedback about the italic style. Personally, I'd avoid it because some users find it difficult to read.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have made it italic based on styling of the help text of BaseControl which is used as a base for most of other controls. If there are italics missing for help texts similar to this, they are inconsistent with the rest. Just a few examples:

Screenshot 2019-05-06 at 21 18 19

Screenshot 2019-05-06 at 21 18 29

Screenshot 2019-05-06 at 21 19 10

I agree on the issue with italics but I think we should address that separately and on a global level for all those existing usages of BaseControl. What do you think about leaving this PR as italics and opening a discussion to replace them globally for all help texts? I'll be happy to make that PR once we settle on a solution.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think italics vs. no italics can be discussed separately — this PR is just mirroring the existing styles used in .components-base-control__help.

(From some quick clicking around, it seems that the Permalink help text is the only text of this kind that isn't italicized, so we should make a decision one way or another).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Italic is terrible for some kind of dyslexia when used on whole sentences. I vote for just not add new Italic. Also, planning to create related GitHub issue and Trac ticket. Thank you.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool — I'm fine getting rid of the italic globally if we can replace it with something else. I just want to make sure that help text appears differently from the form field label so users can tell them apart. But there are other ways to do that besides making the text italic. I'll keep an eye out for the ticket and try out some ideas there. 🙂

Copy link
Contributor

@afercia afercia May 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are other ways to do that besides making the text italic

Definitely agree. One day before I die I'd like to see a typographic system in WordPress 🙂

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've opened #15683 to track the inconsistent help text, and to consider the use of italic text there. We'll get that sorted out globally in Gutenberg. 🙂

In the meantime, that shouldn't block this PR since it's not adding any new styles — just replicating the existing BaseControl help text style.

@afercia afercia added the Needs Design Feedback Needs general design feedback. label May 6, 2019
@afercia afercia self-requested a review May 6, 2019 17:00
Copy link
Contributor

@afercia afercia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @marekhrabe, I left some comments.

Re: the Italic text, I'd like some design feedback. I'd like to avoid it as much as possible for better readability. Also, seems to me Gutenberg isn't using Italic for this kind of hints underneath input fields, for example:

Screenshot 2019-05-06 at 18 24 23

/Cc @karmatosed

Copy link
Member

@jorgefilipecosta jorgefilipecosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this component has a label and a help text feature offered by the BaseControl component: https://github.com/WordPress/gutenberg//blob/1e40b281d1db725e512e383b5e00f3b59e333d5a/packages/components/src/base-control/README.md

Would it be possible to use the base control here, avoid the need for label and help text custom styles and promoting code reusability?

<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">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like the id components-form-token-suggestions-howto-${ instanceId } is not being referenced anywhere, can we remove the id?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marekhrabe
Copy link
Contributor Author

I've actually tried using BaseControl but it cannot be easily used as this component attaches a lot of additional attributes on the wrapping element and that's not supported.

Copy link
Contributor

@kjellr kjellr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marekhrabe This is looking great. Just a tiny design change before it's ready to merge on my end. Currently, the first version of the label says:

Separate using commas or the Enter key

We should add a period at the end there to align with other help text. Unfortunately, that awkwardly pushes the word "key." onto its own line on desktop screens. 😄

To avoid that, let's swap out "using" with the word "with":

Screen Shot 2019-05-16 at 10 56 07 AM

We can also make that change with the second label version that includes the mention of spaces:

Screen Shot 2019-05-16 at 1 55 31 PM

@marekhrabe
Copy link
Contributor Author

What a fix! 😀Message updated, code rebased.

Copy link
Contributor

@kjellr kjellr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great from a design perspective. 👍

@kjellr
Copy link
Contributor

kjellr commented May 16, 2019

Re: the Italic text, I'd like some design feedback. I'd like to avoid it as much as possible for better readability.

@afercia: Now that we have #15683 in progress to track this globally, is this PR all ready to go on your end?

@afercia
Copy link
Contributor

afercia commented May 16, 2019

👍 from me.

@marekhrabe
Copy link
Contributor Author

Thanks, @afercia. Can you please update the review too? Github still blocks me from merging as you requested changes previously.

Merging is blocked
Merging can be performed automatically once the requested changes are addressed.

@marekhrabe marekhrabe added this to the 5.8 (Gutenberg) milestone May 16, 2019
@marekhrabe marekhrabe merged commit b193b09 into master May 16, 2019
@marekhrabe marekhrabe deleted the fix/token-field-help-text branch May 16, 2019 21:01
@marekhrabe marekhrabe self-assigned this May 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). Needs Design Feedback Needs general design feedback. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Useful content is unnecessarily hidden
4 participants