🚸 (bot) disable auto focus on mobile
This commit is contained in:
@@ -19,11 +19,11 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const answersCounts: { groupId: string; totalAnswers: number }[] =
|
||||
await Promise.all(
|
||||
(typebot.publishedTypebot as unknown as PublicTypebot).groups.map(
|
||||
async (block) => {
|
||||
async (group) => {
|
||||
const totalAnswers = await prisma.answer.count({
|
||||
where: { groupId: block.id },
|
||||
where: { groupId: group.id },
|
||||
})
|
||||
return { groupId: block.id, totalAnswers }
|
||||
return { groupId: group.id, totalAnswers }
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
} from 'models'
|
||||
import React, { ChangeEvent, ChangeEventHandler } from 'react'
|
||||
import PhoneInput, { Value, Country } from 'react-phone-number-input'
|
||||
import { isMobile } from 'services/utils'
|
||||
|
||||
type TextInputProps = {
|
||||
inputRef: React.RefObject<any>
|
||||
@@ -112,7 +113,7 @@ export const TextInput = ({
|
||||
block.options.labels.placeholder ?? 'Your phone number...'
|
||||
}
|
||||
defaultCountry={block.options.defaultCountryCode as Country}
|
||||
autoFocus
|
||||
autoFocus={!isMobile}
|
||||
/>
|
||||
)
|
||||
}
|
||||
@@ -129,7 +130,7 @@ const ShortTextInput = React.forwardRef(
|
||||
className="focus:outline-none bg-transparent px-4 py-4 flex-1 w-full text-input"
|
||||
type="text"
|
||||
style={{ fontSize: '16px' }}
|
||||
autoFocus
|
||||
autoFocus={!isMobile}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
@@ -151,7 +152,7 @@ const LongTextInput = React.forwardRef(
|
||||
data-testid="textarea"
|
||||
required
|
||||
style={{ fontSize: '16px' }}
|
||||
autoFocus
|
||||
autoFocus={!isMobile}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user