我想你根据 #packages/components/combobox 和 #packages/components/color-picker 的 lit 和 vanilla…
- User
我想你根据 #packages/components/combobox 和 #packages/components/color-picker 的 lit 和 vanilla 的 example 来帮我编写一下 #packages/components/otp-input 的 examples 中的 lit 和 vanilla 的例子.你可以看看 #packages/components/otp-input 中的 react 和 solid, vue, svelte ,同时别忘了在 storybook 中注册哦
Assistant
- User
这个也出现了一个问题,我们的 输入框中被加上了 readonly 的标识,导致无法输入,你应该在 connection 中增加判断,你可以看看 color-picker 是怎么做的
Assistant
Checking OTP input connection moduleInvestigating readonly attribute issueInvestigating readOnly attribute source****Fixing conditional readOnly attribute
codeSummarizing minor updates and testing status- Updated
connect.tsso thereadOnlyattribute is only added when the component is actually configured as read-only, matching the color-picker pattern. This prevents browsers from forcing the OTP inputs into read-only mode whenreadOnlyis falsey while preserving the attribute for true cases.No tests were executed (connect-layer tweak only). Consider running the relevant Storybook stories or framework demos to confirm the inputs now accept typing normally.
- User
但是我发现 lit 还是无法输入,同时我在 vanilla 的例子中第一次输入的时候他是没有办法自己跳到第二个的,我输入了第一个他不会跳到第一个,但是我如果都输入过了,然后在清空,他就会自己跳到下一个了.这也需要修复一下
Assistant
Investigating read-only input in Lit componentsInvestigating rerender impact on input resetConsidering searching for packages****Analyzing Lit input initialization issues
I'm exploring why the readOnly attribute issue persists in the lit example despite removing it conditionally, suspecting the DOM inputs might not exist when the machine's setupValue action runs. This could cause the machine to see zero input elements initially and set empty values, affecting input length and behavior, so I want to check how otpInputControls handles initial values or state context to understand the proper initialization flow.Analyzing initial input focus issue****Verifying input element count