Skip to content

background color on the last otp input. #425

Open

Description

@ayobamiseun

i get this weird background color on the last input
otp issues

Activity

  1. guilherme-oliveira-trybe commented on Oct 31, 2023

    @guilherme-oliveira-trybe

    i have the same problem and i try to fix with css properties on my input but not working

  2. itz-saran commented on Nov 1, 2023

    @itz-saran

    @ayobamiseun same here any updates on how you fixed it ?

  3. CCoder23 commented on Nov 4, 2023

    @CCoder23

    i think on focusInput if we comments out selecting the input it works: i mean this line inputRefs.current[activeInput]?.select();

  4. ayobamiseun commented on Nov 5, 2023

    @ayobamiseun
    Author

    i think on focusInput if we comments out selecting the input it works: i mean this line inputRefs.current[activeInput]?.select();

    where can this be done

  5. devlopersabbir commented on Dec 27, 2023

    @devlopersabbir

    I fixed this problem on this pull request #432

  6. jethrolibutan commented on Dec 27, 2023

    @jethrolibutan

    i think on focusInput if we comments out selecting the input it works: i mean this line inputRefs.current[activeInput]?.select();

    where can this be done

    hello, was this ever solved?

  7. ianjojo commented on Aug 31, 2024

    @ianjojo

    still seems to be an issue, any word on this?

  8. AlexSapoznikov commented on Mar 4, 2025

    @AlexSapoznikov

    It is because last input keeps focus. Here is how I solved it:

       const NUM_INPUTS = 6
    
       <OtpInput
            value={code}
            onChange={onChangeCode}
            numInputs={NUM_INPUTS}
            renderSeparator={<span>&nbsp;&nbsp;</span>}
            renderInput={(props, index) => (
              <input
                {...props}
                onChange={(e) => {
                  props.onChange?.(e);
    
                  // Last item changed.
                  if (index === NUM_INPUTS - 1) {
                    (e.target as HTMLInputElement)?.blur();
                  }
                }}
              />
            )}
            shouldAutoFocus
          />
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions