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

Remove visible caret - iOS always visible #44

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

Conversation

codercodingthecode
Copy link

@codercodingthecode codercodingthecode commented Apr 13, 2024

Update Styling Properties in OTPInput Component to Remove Caret.
Partially resolve #32 UI Issue

Update:

  • This pull request introduces updates to the styling properties of the OTPInput component within the input.tsx file.
  • The changes aim to enhance the component's visual appearance and consistency with the overall design system to reduce internal styling.
  • The changes prevent the caret from displaying on the screen when all the inputs are filled in on iOS.
  • Users are not forced to auto-submit or blur when all characters/digits are filled in.

Changes:

  • Removed the font-family: 'monospace' property.
  • Added box-sizing: 'border-box' property.

Rationale:
The removal of the monospace font family from the OTPInput component is motivated by a desire to maintain visual consistency throughout the application. As most components utilize the default system font, aligning the OTPInput component with this standard enhances the cohesive appearance of the interface and reduces the internal styling of the components.

Before
image

After
image

The introduction of the box-sizing: 'border-box' property addresses layout challenges encountered with the component's sizing. By including padding and borders in the component's dimensions, we can avoid unexpected layout shifts and provide a more stable and predictable interface for users.

Before
image

After
image

Result
image

Impact:

  • These changes are expected to improve the visual consistency of the OTPInput component and preventing the caret from displaying.
  • No major impacts on functionality or existing layouts are anticipated, as the adjustments are primarily aesthetic and pertain to internal component spacing.

Copy link

vercel bot commented Apr 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
rodz-input-otp ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 13, 2024 8:38am

@guilhermerodz
Copy link
Owner

hi @codercodingthecode thank you for tackling this issue!

however, this issue is bigger than what we all initially thought...

if the visible caret isn't visible, then it negatively impacts the position where the iOS' long-press context menu will pop. that's why I had to leave a single pixel width caret for iOS, so that it at leasts know where to show.

CleanShot.2024-04-14.at.14.29.50-converted.mp4

regarding the monospace font choice:

  • enforcing monospace font hasn't been an issue as it really doesn't affect anything in appearance when JS is enabled on the page. haven't had any reports about the monospace choice yet.
  • enforcing monospace helps with consistent spacing per-character, as input-otp implementation is currently "hacky" and needs some predictability/tests.

@ssijak
Copy link

ssijak commented Apr 17, 2024

@guilhermerodz Is there any way to fix caret showing up on iOS then?

@ssijak
Copy link

ssijak commented Apr 17, 2024

can we set opacity to 0.01 to remove the caret

@guilhermerodz
Copy link
Owner

guilhermerodz commented Apr 23, 2024

can we set opacity to 0.01 to remove the caret

that would be so cool! however, iOS does not play well when selecting invisible text 😢

iirc, the dropdown menu does not even show up

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.

Limitations/issues caused by core implementation
3 participants