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

[Bug]: ReadOnly InputNumber is editable #2238

Closed
danieldvorak opened this issue Aug 11, 2021 · 0 comments
Closed

[Bug]: ReadOnly InputNumber is editable #2238

danieldvorak opened this issue Aug 11, 2021 · 0 comments
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@danieldvorak
Copy link

I have read-only input number. Read-only inputs shouldn't be editable. But in this case PrimeReact allows me to edit values in read-only input number. Codesandbox is below.

const [value1, setValue1] = useState(42723);
const [isReadonly, setIsReadonly] = useState(true);

return (
    <div>
      <div className="card">
        <h5>Numerals</h5>
        <div className="p-fluid p-grid p-formgrid">
          <div className="p-field p-col-12 p-md-3">
            <label htmlFor="integeronly">Integer Only</label>
            <InputNumber
              readOnly={isReadonly}
              inputId="integeronly"
              value={value1}
              onValueChange={(e) => setValue1(e.value)}
            />
          </div>
        </div>
      </div>
    </div>
);

[ ] bug report
ReadOnly InputNumber is editable.

[ ] feature request
ReadOnly InputNumber shouldn't be editable in no situations.

Codesandbox Case (Bug Reports)

https://codesandbox.io/s/recursing-night-rc3cy

Current behavior
Read-only input number is editable. I tried to make read-only input number in your Codesandbox in demo. Forked Codesendox is above.

Expected behavior
Read-only input automatically shouldn't be editable and shouldn't allow to change data by the user, but should allow to change value by setState etc. by other functions in my components.

Minimal reproduction of the problem with instructions
Create statefull component containing InputNumber with readOnly prop.

Please tell us about your environment:
W10, Chrome, Opera, Edge...

  • React version:
    17.0.2

  • PrimeReact version:
    6.4.1 (but in Codesandbox is 6.5.0 and issue is still there)

  • Language: all

@danieldvorak danieldvorak changed the title ReadOnly InputNumber is editable [Bug]: ReadOnly InputNumber is editable Sep 2, 2021
@mertsincan mertsincan self-assigned this Nov 7, 2021
@mertsincan mertsincan added the Type: Bug Issue contains a defect related to a specific component. label Nov 7, 2021
@mertsincan mertsincan added this to the 7.0.0.Final milestone Nov 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

No branches or pull requests

2 participants