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

Textfield type="password" not working for antd style #345

Closed
purplecones opened this issue Sep 11, 2017 · 10 comments · Fixed by #346
Closed

Textfield type="password" not working for antd style #345

purplecones opened this issue Sep 11, 2017 · 10 comments · Fixed by #346
Assignees
Labels
Type: Bug Bug reports and their fixes

Comments

@purplecones
Copy link
Contributor

The 'uniforms-antd/TextField does not properly pass the type prop. See below.

For demonstration, I imported both antd and unstyled versions. The antd does not mask the input field as expected.

import AutoForm from 'uniforms-antd/AutoForm';
import TextField from 'uniforms-antd/TextField';
import TextField2 from 'uniforms-unstyled/TextField';

<AutoForm schema={loginFormSchema} onSubmit={submitLogin}>
 <TextField name="email" />
 <TextField name="password" type="password" />
 <TextField2 name="password" type="password" />
 <SubmitField>Submit</SubmitField>
</AutoForm>

2017-09-11 10 40 16

@radekmie radekmie added the Type: Bug Bug reports and their fixes label Sep 11, 2017
@radekmie radekmie self-assigned this Sep 11, 2017
@radekmie
Copy link
Contributor

Yep, it's filtered with filterDOMProps. Would you submit a PR for it?

@purplecones
Copy link
Contributor Author

Looks like the the transpiled files were not updated.

// uniforms-antd/Textfield.js | lines 33 - 45
var Text = function Text(props) {
    return (0, _wrapField2.default)(props, _react2.default.createElement(_input2.default, (0, _extends3.default)({
        disabled: props.disabled,
        id: props.id,
        name: props.name,
        onChange: function onChange(event) {
            return props.onChange(event.target.value);
        },
        placeholder: props.placeholder,
        // missing 'type' prop here 
        ref: props.inputRef, 
        value: props.value
    }, (0, _filterDOMProps2.default)(props))));
};

@radekmie
Copy link
Contributor

Yep, my fault. I've published fixed 1.20.3. Sorry!

@purplecones
Copy link
Contributor Author

All good now! thanks

@jchristman
Copy link

I believe I'm having this same issue in uniforms-material, but I can't for the life of me figure out why. I don't think it's filtered by filterDOMProps based on my reading of the code, but the screenshots below show that it's somehow getting filtered out...

screen shot 2018-06-10 at 12 08 29 am

screen shot 2018-06-10 at 12 08 43 am

I'm using the following code to generate the form:

import React from 'react';
import Autoform from 'uniforms-material/Autoform';
import TextField from 'uniforms-material/TextField';
import SubmitField from 'uniforms-material/SubmitField';

import { LoginSchema } from '/lib/schemas.js';

const onSubmit = (doc) => {
  Meteor.loginWithPassword(doc.email, doc.password, (err) => {
    if (err !== undefined) {
      console.log(err);
    } else {
      console.log('Login success! Redirect!');
    }
  });
};

const Login = (props) => (
  <div className='login-modal'>
    <Autoform schema={LoginSchema} placeholder={true} label={false} onSubmit={onSubmit}>
      <TextField name='email'/>
      <TextField name='password' type='password'/>
      <SubmitField/>
      <p>Don&apos;t have an account? <a href='/signup'>Register</a></p>
    </Autoform>
  </div>
);

export default Login;

@jchristman
Copy link

Thanks for the quick add for that! Much appreciated!

@ziedmahdi
Copy link

Hi,

This is may not be the same issue as described above but it's definitely similar.

On https://uniforms.tools if you check the example forms and type something in the password field, the text is shown or it should be hidden.

image

Is this intentional?

Thank you.

@radekmie
Copy link
Contributor

Hi @ziedmahdi. No, it's not intentional - it's a bug. Thanks for the report, we'll get to it soon.

@alihuber
Copy link

alihuber commented Oct 5, 2021

Cloud it be that this issue reappeared? This is happening to me with semantic and uniforms-bridge-simple-schema-2, v3.6.1:

Bildschirmfoto 2021-10-05 um 20 03 16

Bildschirmfoto 2021-10-05 um 20 02 56

Even on the playground it seems to work with JSONSchema, but not SimpleSchema, regardless of the chosen theme.

@wadamek65
Copy link
Contributor

Hi @alihuber ,

Thanks for your comment. It does indeed seem like the same problem is present in simple schema bridges. I've managed to write a test to reproduce this bug and filed an issue for it here: #1039 If you have any other remarks please post them there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Bug reports and their fixes
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

6 participants