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

fix: Step Input #986

Merged
merged 14 commits into from
May 18, 2020
Merged

fix: Step Input #986

merged 14 commits into from
May 18, 2020

Conversation

JKMarkowski
Copy link
Contributor

Related Issue

fixes: #779

Description

Screenshots

NOTE: If you've made any style changes, please provide appropriate screenshots (before and after) to help reviewers.

To see examples of which screenshots to include, go to Screenshot Examples.

Before:

After:

image
image

@JKMarkowski JKMarkowski added this to the Sprint 36 - Plovdiv milestone May 8, 2020
@JKMarkowski JKMarkowski requested a review from a team May 8, 2020 09:33
@netlify
Copy link

netlify bot commented May 8, 2020

Deploy preview for fundamental-styles ready!

Built with commit 456ce56

https://deploy-preview-986--fundamental-styles.netlify.app

@droshev
Copy link
Contributor

droshev commented May 8, 2020

Can you create a storybook instead of njk visual tests?

folder: components
---

The Step Input component is an opinionated composition of the Input, Button components.
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 the description from the Fiori Guidelines? I think it sounds better. I also included the usage guidelines in case you want to add them.

The step input control allows the user to change the input values in predefined increments (steps).

Usage
Use the step input if:
The user needs to adjust amounts, quantities, or other values quickly.
The user needs to adjust values for a specific step (for example, in a shopping cart).
Do not use the step input if:
The user needs to enter a static number (for example, postal code, phone number, or ID). In this case, use the regular input field control instead.
You want to display a value that rarely needs to be adjusted and does not pertain to a particular step. In this case, use the regular input field control instead.
You want the user to enter dates and times. In this case, use the date picker, date range selection, time picker, or date/time picker instead.



## Step Input with Cozy
Cozy Mode is the default one, it should be used in mobile and tablet devices.
Copy link
Contributor

Choose a reason for hiding this comment

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

On smartphones and tablets, the step input is shown in cozy mode (default).



## Compact Step Input
Step Input can be used in compact mode, which is done to be used in desktop, or larger screen devices.
Copy link
Contributor

Choose a reason for hiding this comment

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

The Step Input should be used in compact mode when using a desktop of devices with large screens. It can be achieved by adding the --compact modifier to the main element as well as the button and input elements.

{% include display-component.html component=step-input-compact %}

## Step Input with Different states
Step Input Component also supports semantic states, same as for every form. They can be achieved by adding
Copy link
Contributor

Choose a reason for hiding this comment

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

The Step Input component also supports semantic states as does every form. The semantic states can be customized by adding the is-error | is-success | is-warning | or is-information into the fd-step-input element.

@JKMarkowski
Copy link
Contributor Author

JKMarkowski commented May 11, 2020

@droshev

Can you create a storybook instead of njk visual tests?

For now both are added

$fd-step-input-compact-button-width: 1.5rem;
$fd-step-input-description-padding: 0.5rem;

@mixin iconSize($size) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it worth to create a mixin if its used only once?

border-color: var(--sapField_BorderColor);
border-radius: var(--sapField_BorderCornerRadius);
background-color: var(--sapField_Background);
height: calc(#{$fd-step-input-cozy-height} + 2 * var(--sapField_BorderWidth));
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know if this is correct because there is no exact value in spec, but our standard input height is 36px and step-input height is 38px.

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 are right, there should be 36px with borders included (34px + 2px)

@include fd-focus() {
outline: none;

&,
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't you use @include fd-hover() here?

}

/** Width is different due to different border width */
&.is-information,
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing success state

Copy link
Contributor Author

Choose a reason for hiding this comment

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

success has 1px from mixin

&.is-error,
&.is-warning {
.#{$block}__button.#{$fd-namespace}-button {
width: calc(#{$fd-step-input-cozy-button-width} - 0.125rem);
Copy link
Contributor

Choose a reason for hiding this comment

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

We should move 0.125rem to a variable

@JKMarkowski
Copy link
Contributor Author

All changes are addressed, it's ready to be reviewed again

Copy link
Contributor

@Vanessa-Cusmich Vanessa-Cusmich left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@mikerodonnell89 mikerodonnell89 left a comment

Choose a reason for hiding this comment

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

can we just have --no-number-spinner be default behavior for our number type inputs so no extra class is needed?

@JKMarkowski
Copy link
Contributor Author

can we just have --no-number-spinner be default behavior for our number type inputs so no extra class is needed?

We decided to have it in other PR

@prsdthkr
Copy link
Member

It think it is because of the Fiori 3 spec, but the focus ring is not visible on the individual step up and step down buttons as seen in the patterns example. I can see this becoming an accessibility issue.

Patterns example shows focus ring on individual buttons:
image

image

Copy link
Contributor

@InnaAtanasova InnaAtanasova 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!

@prsdthkr
Copy link
Member

It think it is because of the Fiori 3 spec, but the focus ring is not visible on the individual step up and step down buttons as seen in the patterns example. I can see this becoming an accessibility issue.

Correction: It is okay that the focus ring is not appearing on the step buttons. This is in line with the <input type="number"> implementation as seen here: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/step.

But we should also make sure that the buttons inside the input are not tab-able. Currently there is an invisible tab stop. As seen in the above GIF.

@JKMarkowski
Copy link
Contributor Author

@prsdthkr Thanks for pointing it, I will add tabindex: -1 to all buttons, to make them not tabable

@JKMarkowski JKMarkowski merged commit 5301d44 into master May 18, 2020
@JKMarkowski JKMarkowski deleted the feat/step-input2 branch May 18, 2020 09:03
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.

Refactor StepInput to match Fiori 3 specs
9 participants