Page MenuHomePhabricator

Refer to Codex components and elements consistently in our documentation
Open, Needs TriagePublic

Description

Background

Let's settle on how we refer to components in our docs, we’re mixing them at the moment. We don’t follow any way consistently though.

In a recent comment on a patch by @bmartinezcalvo, @AnneT raised a point about uppercasing only at begin of sentence for consistency. The currently worked on patch by @DTorsani-WMF goes into an also already introduced casing in a different direction.
Example from current docs:

  • Normal buttons have three variants (“flavors”)

But then we’re uppercasing also the weight/variant etc in order to separate and make clear that its describing an attribute of the component:

  • Use Quiet Buttons to emphasize Normal Buttons when both are combined on the same page.

And the plot is getting thicker when talking about components like:

  • The primary action should be represented by a Primary Progressive Button.

While when talking about the concept of a component, more than the component itself, we’ve lowercased again:

  • Reserve destructive buttons for actions that involve removal or limitation, such as deleting a page or blocking a user. Avoid using them for actions like cancel buttons.

Goal

Choose one way and follow it consistently in our public docs and code comments

Open questions

Which of the following options/ways to take?

  1. Uppercasing first-letter when talking about the Codex component, and lowercasing when speaking of the general concept. E.g. “Use Quiet Buttons to emphasize Normal Buttons… cancel buttons”. That would be my suggestion.
  2. Uppercasing only components, never attributes/props, e.g. “Use quiet Buttons to emphasizes normal Buttons… cancel buttons
  3. Uppercasing only beginning of a sentence, e.g. “Use quiet buttons to emphasizes normal buttons… cancel buttons

Please note, that

  • uppercasing results in a different pronunciation in screen readers, helping them to understand the component concept.
  • there’s research has shown that uppercasing helps increase readability, an insightful SO thread

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

I think option 2 is the most intuitive and grammatically correct, with the least gray area.

For option 1, we would now need to be consistent not only with capitalizing component names, but other words that describe components. IMO it doesn't seem natural in English to write about Notice Messages, Inline Radios, or Disabled TextInputs, so I also think we should not capitalize the adjectives in Primary Progressive Button. With the disabled TextInput example, lowercase disabled is really correct here, both in terms of the prop and the attribute name. Trying to follow different rules for different types of props would be a huge headache.

Option 3 is not viable IMO because we have to differentiate between component names and other things with the same name, such as elements. We need to be able to clearly write a sentence about how Button contains a button element. We also need to make it clear when we're talking about a component and not just any element - for example, you can have a clearable TextInput since that component supports that feature, but you can't necessarily have a clearable text input since it's not a native feature of the input element.

I could go for either option 1 or 2. That being said I agree with Anne's comment.

Question: What would you think is the proper way to write the following sentence?

A

A Button should not be styled as a Link and a Link should not be styled as a Button.

or

B

A button should not be styled as a link and a link should not be styled as a button.

Question: What would you think is the proper way to write the following sentence?

A

A Button should not be styled as a Link and a Link should not be styled as a Button.

or

B

A button should not be styled as a link and a link should not be styled as a button.

For this sentence, I think it should be B, since it is talking generally of buttons and links. I think it's wrong in our current docs - in the style guide, we are talking more generally of elements, not about specific components (for the most part, and when we do talk about Codex components, we should capitalize their names).

A similar sentence on a component page might read:

Use a Button to enable the user to take an action and a Link to enable them to navigate to a different page

In fact, the Button page currently says:

Avoid using buttons when:

  • The action is to navigate the user to a new resource, which would take them away from the current context. In such cases, consider Link instead.

I think the word "buttons" in the first sentence should be changed to "a Button" since we're talking specifically about the components.

I think that makes sense, though I will say, it feels like we might have a challenging time clearly understanding when the proper noun should be used or not, but we can try! It seems like there is some consensus for option 2. Shall we move forward with that and create a task to go through and update the docs site accordingly? Additionally, should we document our preference here for how we talk about and write about components somewhere so we can refer back to it and point people there as well?