Skip to content

add maxlength attribute to input to accept maxLength prop#108

Open
chiester wants to merge 1 commit intofurqanZafar:masterfrom
chiester:add-maxlength-attr-to-input
Open

add maxlength attribute to input to accept maxLength prop#108
chiester wants to merge 1 commit intofurqanZafar:masterfrom
chiester:add-maxlength-attr-to-input

Conversation

@chiester
Copy link
Copy Markdown

Added the ability to pass a maxLength attribute so the length of the input in SimpleSelect can be limited.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 90.66% when pulling 3a7c3ea on chiester:add-maxlength-attr-to-input into 2f6be3b on furqanZafar:master.

@chiester chiester force-pushed the add-maxlength-attr-to-input branch from 3a7c3ea to 98e3c8c Compare August 31, 2016 20:08
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 90.66% when pulling 98e3c8c on chiester:add-maxlength-attr-to-input into 2f6be3b on furqanZafar:master.

@ameno-
Copy link
Copy Markdown

ameno- commented May 31, 2017

Any chance this'll get merged @furqanZafar? It's a useful attr and the PR is pretty straightforward.

Comment thread src/ReactSelectize.ls
# class-name :: String
delimiters: []
disabled: false
maxLength: 255
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.

Why make a default limit? this is not backward compatible (i.e. Some usages may need more than 255 characters).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Can't you just override the default? maxLength=1024 , or whatever

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.

You didn't understand me. If I were to use this library and happen to have values with more than 255 characters, upgrading to the version with your feature would break my code unless I specify the maxLength prop. It usually a better practice to make new features "opt-in", meaning not enforcing it unless wanted, and upgrading should not force you to make changes in your code.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for the clarification. That's a good point.

@elisherer
Copy link
Copy Markdown
Contributor

With the PR I did (#160) it will be solved by passing inputProps.maxLength.

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