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

InputOtp: Setting Value does not clear display #6592

Closed
ozziej opened this issue May 8, 2024 · 0 comments · Fixed by #6595, leoo1992/GeradorQRCode#40, mtech-31-quemistry/quemistry_client_web#3 or leoo1992/GeradorQRCode#57 · May be fixed by nhattpn/BTL_LTNC#56
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@ozziej
Copy link

ozziej commented May 8, 2024

Describe the bug

If you modify the value by using setOtpValue for example somewhere in the code, it sets the value correctly, but the InputOtp display does not change.
Unable to supply forked stackblitz as the InputOtp component is not available.

Reproducer

No response

PrimeReact version

10.6.5

React version

18.x

Language

ALL

Build / Runtime

Vite

Browser(s)

Any / All

Steps to reproduce the behavior

import { useState } from 'react';
import { InputOtp } from 'primereact/inputotp';
import { Button } from 'primereact/button';
import { InputText } from 'primereact/inputtext';
import 'primereact/resources/themes/lara-light-indigo/theme.css'; //theme
import 'primereact/resources/primereact.min.css'; //core css
import 'primeicons/primeicons.css'; //icons
import 'primeflex/primeflex.css'; // flex


function App() {
  const [count, setCount] = useState(0);
  const [value, setValue] = useState('');

  return (
    <>
      <div className="App">
        <InputOtp length="4" value={value} onChange={(e) => setValue(e.value)} />
        <Button label="Reset" onClick={() => setValue('')} />
        <InputText value={value} readOnly/>
      </div>
    </>
  );
}

export default App;

Expected behavior

In the above example, InputOtp should clear the display (or at least obey the set "value")
It works correctly with InputText
Screenshot from 2024-05-08 16-49-47
Screenshot from 2024-05-08 16-49-41

@ozziej ozziej added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label May 8, 2024
@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels May 8, 2024
melloware added a commit to melloware/primereact that referenced this issue May 8, 2024
@melloware melloware self-assigned this May 8, 2024
@melloware melloware added this to the 10.7.0 milestone May 8, 2024
melloware added a commit to melloware/primereact that referenced this issue May 8, 2024
melloware added a commit to melloware/primereact that referenced this issue May 8, 2024
melloware added a commit to melloware/primereact that referenced this issue May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment