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

fixed so masked input works with chrome auto-fill and on paste #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

axelson
Copy link

@axelson axelson commented Mar 2, 2016

Fixes issue #21

Edit:
Rebased onto latest master
Only kept relevant change. Change to dist was dropped to help avoid
merge conflicts
Add phone number example to demo page

Test code (add to demo/index.html):

      <form method="post">
        First name: <input type="text" name="fname" />
        Last Name: <input type="text" name="lname" />
      <div className="form-field">
        <label htmlFor="phone">Phone Number:</label>
        <MaskedInput mask="(111) 111-1111" name="phone" id="phone" onChange={this._onChange} placeholder="(999) 999-9999"/>
      </div>

Edit:
Rebased onto latest master
Only kept relevant change. Change to dist was dropped to help avoid
merge conflicts
Add phone number example to demo page
@@ -146,6 +147,14 @@ var MaskedInput = React.createClass({
setTimeout(this._updateInputSelection, 0)
this.props.onChange(e)
}
else {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you educate me on why the if (this.mask.paste(e.clipboardData.getData('Text')) {...} part just before this block returns falsy and falls through to this?

Copy link
Contributor

Choose a reason for hiding this comment

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

The falsy return happens here https://github.com/insin/inputmask-core/blob/master/lib/index.js#L374-L393 on line 391. I'm not exactly sure what that means, but I can dive into it more if need be.

@iamdustan
Copy link
Collaborator

@axelson any response to those qs? That and a rebase and hopefully we can land this.

@alpjor
Copy link

alpjor commented Jun 14, 2016

Any progress on this? I'd rather not fork this project.

@patrickml
Copy link

+1

@aesopwolf
Copy link
Contributor

@alpjor might be worth checking out https://github.com/Pephers/react-autofill

@alpjor
Copy link

alpjor commented Dec 15, 2016

@aesopwolf neat, thanks for link, but I'm pretty conceptually against polling for event listeners if I can help it.

@aesopwolf
Copy link
Contributor

I published a fork of this PR to npm for the time being https://www.npmjs.com/package/react-maskedinput-autofill

@lassombra
Copy link

lassombra commented Apr 11, 2017

Trying to use the published version from npm pushed out by @aesopwolf I discovered a minor bug. If the paste falls through to the second paste method, onChange never fires.

I fixed that in https://github.com/lassombra/react-maskedinput so that I could use this, However I'm unsure how you would like to handle this as that would effectively be a pull request of a pull request...

Specifically this is fixed in this commit: lassombra@b760ed2

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.

6 participants