Skip to content

EuiRange - onValidatedChange props - #1461

Closed
nreese wants to merge 4 commits into
elastic:masterfrom
nreese:validated_range
Closed

nreese wants to merge 4 commits into
elastic:masterfrom
nreese:validated_range

Conversation

@nreese

@nreese nreese commented Jan 20, 2019

Copy link
Copy Markdown
Contributor

fixes #1458

Adds prop onValidatedChange to EuiRange. onValidatedChange is only called when value changes to a Number that is within the provided min and max (inclusive).

@cchaos cchaos left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for adding this, I just saw a couple of issues and had a couple of suggestions.

Also, could you do one more change to support decimals in the sizing of the attached input by changing that line to:

const maxWidthStyle = { maxWidth: `${Math.max(String(min + step).length, String(max + step).length) + 2}em` };

Comment thread src/components/form/range/range.js Outdated
{this.renderLabel('max')}
{extraInputNode}
</div>
{this.renderErrorMessage()}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we should leave out rendering the error message in the DOM because this should technically be handled by a EuiFormRow that hooks up the message to the input. Currently this error message does not get read by a screen reader as it is.

Maybe it should just pass back an error message then the consumer can hook it into the error prop of EuiFormRow?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok. I will add a onValidationError callback that receives the error message

Comment thread src/components/form/range/range.js Resolved
Comment thread src/components/form/range/range.js Resolved
@nreese

nreese commented Jan 23, 2019

Copy link
Copy Markdown
Contributor Author

@cchaos I am not sure I like having separate callbacks onValidatedChange and onValidationError. What do you think about only having onValidatedChange and it is called with isValid and value? That way the consumer can craft the error message accordingly.

@cchaos

cchaos commented Jan 23, 2019

Copy link
Copy Markdown
Contributor

I think that's fine. That'll also help with localization.

@thompsongl thompsongl mentioned this pull request Jan 28, 2019
10 tasks done
@nreese

nreese commented Feb 4, 2019

Copy link
Copy Markdown
Contributor Author

closing. EuRange refactor has made these changes obsolete

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.

EuiRange show empty string in input when value is empty

2 participants