Skip to content

add error state when !isNumber to Numeric component - #823

Merged
VeraZab merged 4 commits into
masterfrom
numerics-error
Jan 10, 2019
Merged

add error state when !isNumber to Numeric component#823
VeraZab merged 4 commits into
masterfrom
numerics-error

Conversation

@VeraZab

@VeraZab VeraZab commented Jan 9, 2019

Copy link
Copy Markdown
Contributor

closes: #822

screen shot 2019-01-09 at 11 15 41 am

same style as in this pr:
#811 (comment)

@VeraZab

VeraZab commented Jan 9, 2019

Copy link
Copy Markdown
Contributor Author

Because NumericInput is the base widget used in all numerics (DualNumeric, derived components) adding validation to it should be working for anywhere there's numerics involved.

@dmt0 @nicolaskruchten ready for review

Comment thread src/styles/components/widgets/_numeric-input.scss

this.state = {value: props.value};
this.state = {
value: props.value,

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 know this is not a new code addition, but assigning props to state is such an antipattern.

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.

that's our way of not having plotly.js reject the value and override with its default

@nicolaskruchten

Copy link
Copy Markdown
Contributor

On my screen the little gray fuzzy focus style hides the red...

image

@VeraZab

VeraZab commented Jan 9, 2019

Copy link
Copy Markdown
Contributor Author

focussed version:
screen shot 2019-01-09 at 2 17 31 pm

@VeraZab

VeraZab commented Jan 9, 2019 via email

Copy link
Copy Markdown
Contributor Author

@nicolaskruchten

Copy link
Copy Markdown
Contributor

same comments as the other validation one: there's no easy "back out to defaults" mode... once it's red it stays red and deleting it doesn't undo... Can we have it accept "" such that plotly.js will then go back to defaults?

@VeraZab

VeraZab commented Jan 10, 2019

Copy link
Copy Markdown
Contributor Author

2019-01-09 20 35 16

@nicolaskruchten

Copy link
Copy Markdown
Contributor

💃

@VeraZab
VeraZab merged commit 6eaca48 into master Jan 10, 2019
@VeraZab
VeraZab deleted the numerics-error branch January 10, 2019 02:36
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.

Validate Numerics

3 participants