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

Steps are styled #208

Merged
merged 15 commits into from
Dec 15, 2017
Merged

Steps are styled #208

merged 15 commits into from
Dec 15, 2017

Conversation

cchaos
Copy link
Contributor

@cchaos cchaos commented Dec 14, 2017

Other than just adjusting the CSS, I also wrapped a span with "Step #" in a EuiScreenReaderOnly tag for accessibility. Which then allowed me to put the step number in a data attribute on the title and access that number in CSS to output it into a ::before element. This helps to clean up the output HTML a bit.

@cchaos
Copy link
Contributor Author

cchaos commented Dec 14, 2017

@cjcenizal or @snide I'm having issues with how this is trying to get merged in. I tried merging in the branch first but got conflicts of added files that were already added, not just line changes...

# Conflicts:
#	src-docs/src/views/steps/heading_element_steps.js
#	src-docs/src/views/steps/steps.js
#	src-docs/src/views/steps/steps_example.js
#	src/components/steps/__snapshots__/step.test.js.snap
#	src/components/steps/__snapshots__/steps.test.js.snap
#	src/components/steps/_steps.scss
#	src/components/steps/step.js
@cchaos
Copy link
Contributor Author

cchaos commented Dec 14, 2017

Alright, the PR is all good now. I'll be better next time to continually rebase, versus merge.

Copy link
Contributor

@cjcenizal cjcenizal left a comment

Choose a reason for hiding this comment

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

Looking good! Just had a couple comments, mostly minor but one about accessibility.

</p>
<div>
<p>
To aide with accessibility and hierachical headings,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think aide (noun) should be spelled "aid" (verb).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah... you might find that you catch a good amount spelling errors with me... I'm trying to be beter...

Copy link
Contributor

Choose a reason for hiding this comment

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

s/beter/better 😹

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh and "hierachical" should be "hierarchical"

@@ -33,7 +37,7 @@ export const StepsExample = {
demo: <Steps />,
},
{
title: 'Heading Element Steps',
title: 'Heading Elements',
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use sentence case?

{step}
</div>
<EuiTitle className="euiStepTitle">
<EuiScreenReaderOnly><span>Step {step}</span></EuiScreenReaderOnly>
Copy link
Contributor

Choose a reason for hiding this comment

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

When I test the UI with VoiceOver on OS X, it reads "Step 1", "1 , inspect me". So I think a solution similar to one you explored earlier would be better, where "step" is the only word added for the screen reader. That, or "step 1" is added for the screen reader, but the we also hide the visible "1" from the screen reader.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh really? I always thought content in pseudo elements were not seen by screen readers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cjcenizal Do you think it would be ok to just remove the step number from that line?

Copy link
Contributor

@snide snide left a comment

Choose a reason for hiding this comment

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

Looks good. Very minor comments. Nice work.

<h1>Heading 1</h1>
<EuiText><h1>Heading 1</h1></EuiText>

<br/><br/>
Copy link
Contributor

Choose a reason for hiding this comment

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

Use an EuiSpacer here.

title: 'inspect me',
children: <h3>Did you notice the step title is inside a Heading 2 element?</h3>
title: 'Inspect me',
children: <EuiText><h3>Did you notice the step title is inside a Heading 2 element?</h3></EuiText>
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor one. <EuiText> should be used for blobs of text. In this case, you're only using it for a title, so might want to use <EuiTitle>.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 You're right

</div>
<EuiTitle className="euiStepTitle">
<EuiScreenReaderOnly><span>Step {step}</span></EuiScreenReaderOnly>
<EuiTitle className="euiStep__title" data-step-num={step}>
{React.createElement(headingElement, null, title)}
Copy link
Contributor

Choose a reason for hiding this comment

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

Might want to assign headingElement a default prop value in this file as well as the one that's set in EuiSteps.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it not being passed down from EuiSteps to EuiStep?

Copy link
Contributor

Choose a reason for hiding this comment

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

It is. But I like to think of components as separately usable. Because it's being set as required, you may as well provide it a default. Just a good practice, even if most use cases it would be overwritten by whatever it inherits.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it just adding the following to step.js?

EuiStep.defaultProps = {
  headingElement: 'p'
};

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep!

padding-left: 24px;
}
.euiStep__title::before {
content: attr(data-step-num); // Get the number from the data attribute
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@@ -1,27 +1,46 @@
.euiSteps {
$euiStepNumberSize: $euiSizeXL !default;
$euiStepNumberMargin: $euiSize !default;
Copy link
Contributor

Choose a reason for hiding this comment

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

When we've done these component level vars, we've generally put them in the _index.scss file so that they could be used through the various files in the component (can see this in the forms/_index.scss file). Dunno if that makes sense. I'm a little torn on using inner component tokenization when they just inherit global values. They do make things easier to tweak across a component, it's just a slight bit harder to grok when you read the doc.

No changes needed, just kind of voicing random thoughts and seeing if you had opinions.

Copy link
Contributor Author

@cchaos cchaos Dec 14, 2017

Choose a reason for hiding this comment

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

Here is my thought process:

I create a component level var if the same value (global or custom) will need to be reused in multiple places especially where calculations are made based on that value. For instance:

// Align the content's contents with the title
padding-left: ($euiStepNumberSize/2) - 1px + $euiStepNumberMargin;

That way if someone want to change the sizing of the number, they do it in one place and all the alignments and calcs will get updated. Just reduces human error.

Then the only reason they're not scoped to a particular selector is because I needed to reference them in multiple selectors and didn't feel it was necessary to add to the inheritance just for scoped variables.

Copy link
Contributor

Choose a reason for hiding this comment

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

Works for me. It's more me not liking to have to type everything out 🐻 , but all your points make sense.

@cchaos
Copy link
Contributor Author

cchaos commented Dec 15, 2017

Ok I think all comments have been addressed.

Copy link
Contributor

@cjcenizal cjcenizal left a comment

Choose a reason for hiding this comment

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

LGTM! But could you address my comments about spelling and sentence case?

@cchaos
Copy link
Contributor Author

cchaos commented Dec 15, 2017

@cjcenizal Ugh, I had forgotten to save that file. Ok It's all pushed now.

Copy link
Contributor

@cjcenizal cjcenizal left a comment

Choose a reason for hiding this comment

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

🍯 LGTM!

@cchaos cchaos merged commit 3e488a0 into elastic:steps_component Dec 15, 2017
@cchaos cchaos deleted the steps-style branch December 21, 2017 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants