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