Skip to content

Commit

Permalink
chore(input): remove unused event listeners
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhermerodz committed Mar 9, 2024
1 parent 25e14b4 commit 68c5cec
Showing 1 changed file with 0 additions and 45 deletions.
45 changes: 0 additions & 45 deletions packages/input-otp/src/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -537,51 +537,6 @@ export const OTPInput = React.forwardRef<HTMLInputElement, OTPInputProps>(
_pasteListener(e)
props.onPaste?.(e)
}}
onTouchEnd={e => {
const isFocusing = document.activeElement === e.currentTarget
if (isFocusing) {
setTimeout(() => {
_selectListener()
}, 50)
}

props.onTouchEnd?.(e)
}}
onTouchMove={e => {
const isFocusing = document.activeElement === e.currentTarget
if (isFocusing) {
setTimeout(() => {
_selectListener()
}, 50)
}

props.onTouchMove?.(e)
}}
onClick={e => {
inputRef.current.__metadata__ = Object.assign(
{},
inputRef.current?.__metadata__,
{ lastClickTimestamp: Date.now() },
)

props.onClick?.(e)
}}
onDoubleClick={e => {
const lastClickTimestamp =
inputRef.current?.__metadata__?.lastClickTimestamp

const isFocusing = document.activeElement === e.currentTarget
if (
lastClickTimestamp !== undefined &&
isFocusing &&
Date.now() - lastClickTimestamp <= 300 // Fast enough click
) {
e.currentTarget.setSelectionRange(0, e.currentTarget.value.length)
syncTimeouts(_selectListener)
}

props.onDoubleClick?.(e)
}}
onInput={e => {
syncTimeouts(_selectListener)

Expand Down

0 comments on commit 68c5cec

Please sign in to comment.