-
Notifications
You must be signed in to change notification settings - Fork 843
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
Steps are styled #208
Conversation
…me and rest to EuiStep
# Conflicts: # src-docs/src/views/steps/heading_element_steps.js # src-docs/src/views/steps/steps.js
@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
Alright, the PR is all good now. I'll be better next time to continually rebase, versus merge. |
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.
Looking good! Just had a couple comments, mostly minor but one about accessibility.
</p> | ||
<div> | ||
<p> | ||
To aide with accessibility and hierachical headings, |
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 think aide (noun) should be spelled "aid" (verb).
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.
Yeah... you might find that you catch a good amount spelling errors with me... I'm trying to be beter...
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.
s/beter/better 😹
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.
Oh and "hierachical" should be "hierarchical"
@@ -33,7 +37,7 @@ export const StepsExample = { | |||
demo: <Steps />, | |||
}, | |||
{ | |||
title: 'Heading Element Steps', | |||
title: 'Heading Elements', |
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.
Can we use sentence case?
src/components/steps/step.js
Outdated
{step} | ||
</div> | ||
<EuiTitle className="euiStepTitle"> | ||
<EuiScreenReaderOnly><span>Step {step}</span></EuiScreenReaderOnly> |
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.
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.
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.
Oh really? I always thought content in pseudo elements were not seen by screen readers.
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.
@cjcenizal Do you think it would be ok to just remove the step number from that line?
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.
Looks good. Very minor comments. Nice work.
<h1>Heading 1</h1> | ||
<EuiText><h1>Heading 1</h1></EuiText> | ||
|
||
<br/><br/> |
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.
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> |
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.
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>
.
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.
👍 You're right
src/components/steps/step.js
Outdated
</div> | ||
<EuiTitle className="euiStepTitle"> | ||
<EuiScreenReaderOnly><span>Step {step}</span></EuiScreenReaderOnly> | ||
<EuiTitle className="euiStep__title" data-step-num={step}> | ||
{React.createElement(headingElement, null, title)} |
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.
Might want to assign headingElement
a default prop value in this file as well as the one that's set in EuiSteps
.
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.
Is it not being passed down from EuiSteps to EuiStep?
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.
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.
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.
Is it just adding the following to step.js?
EuiStep.defaultProps = {
headingElement: 'p'
};
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.
Yep!
padding-left: 24px; | ||
} | ||
.euiStep__title::before { | ||
content: attr(data-step-num); // Get the number from the data attribute |
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,27 +1,46 @@ | |||
.euiSteps { | |||
$euiStepNumberSize: $euiSizeXL !default; | |||
$euiStepNumberMargin: $euiSize !default; |
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.
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.
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.
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.
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.
Works for me. It's more me not liking to have to type everything out 🐻 , but all your points make sense.
Ok I think all comments have been addressed. |
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.
LGTM! But could you address my comments about spelling and sentence case?
@cjcenizal Ugh, I had forgotten to save that file. Ok It's all pushed now. |
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.
🍯 LGTM!
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.