-
Notifications
You must be signed in to change notification settings - Fork 126
Fix issues around pasting into ReactCodeInput #154
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
Conversation
changes also include upgrading the package-lock.json file for the latest version of npm (7.24.0)
there is a direct import from prop-types in ReactCodeInput.js
prevents this error after upgrade to storybook v5: webpack/webpack#8082
no more need to add sass loader manually by extending the webpack config
Array.prototype.map() won’t early return if you return true, but Array.prototype.some() will
also, fix naming typo from chart → char
cleans up the code where that variable is used and ensures the value being used is always a number (e.g. in the else condition of the ternary for determining the index within this.textInput when assigning newTarget)
• fixes 40818419#62 (reproducible in chrome and safari also) • removes need for special keydown handling for ↑/↓/E keys • removes need for styling to remove default input type="number" browser styles • leaves filtering of non-numeric values to existing logic in handleChange (works for pasted text and keyboard entry)
when using maxLength, if user has "623 293" and pastes it into an input with fields={6}, the last digit ("3") won’t be pasted because the max length on the focused input is 6 digits
Codecov Report
@@ Coverage Diff @@ ## master #154 +/- ## ========================================== + Coverage 96.55% 97.70% +1.15% ========================================== Files 2 2 Lines 145 131 -14 Branches 41 35 -6 ========================================== - Hits 140 128 -12 + Misses 5 3 -2
Continue to review full report at Codecov.
|
1236d1f to
3403072
Compare
Uh oh!
There was an error while loading. Please reload this page.
note that this branch was branched off of #153 and will be easier to review in isolation from those changes.
fixed some issues around pasting, including:
type="text"when props.type is'number'to avoid browser bugs b65e90etype="number"browser styleshandleChangemethod. this works for both pasted text and keyboard entry thanks to the input type being text; when input type is number, paste doesn’t trigger a react onChange event and it is impossible to get the behavior 100% correct (inputElement.valueis empty even when it actually has characters in it, e.g. the lettere)maxLengthfrom the inputs so filtered pasted values aren’t truncated 3403072fields={6}, the last digit ("6") won’t be pasted because the max length on the focused input is 6 digits