mirror of
https://github.com/formbricks/formbricks.git
synced 2026-04-25 03:39:31 -05:00
Fix: Disable autoFocus when embedded with iframe (#615)
This commit is contained in:
@@ -9,6 +9,7 @@ interface OpenTextQuestionProps {
|
||||
onSubmit: (data: { [x: string]: any }) => void;
|
||||
lastQuestion: boolean;
|
||||
brandColor: string;
|
||||
autoFocus?: boolean;
|
||||
}
|
||||
|
||||
export default function OpenTextQuestion({
|
||||
@@ -16,6 +17,7 @@ export default function OpenTextQuestion({
|
||||
onSubmit,
|
||||
lastQuestion,
|
||||
brandColor,
|
||||
autoFocus = false,
|
||||
}: OpenTextQuestionProps) {
|
||||
const [value, setValue] = useState<string>("");
|
||||
|
||||
@@ -35,7 +37,7 @@ export default function OpenTextQuestion({
|
||||
<div className="mt-4">
|
||||
{question.longAnswer === false ? (
|
||||
<input
|
||||
autoFocus
|
||||
autoFocus={autoFocus}
|
||||
name={question.id}
|
||||
id={question.id}
|
||||
value={value}
|
||||
@@ -46,7 +48,7 @@ export default function OpenTextQuestion({
|
||||
/>
|
||||
) : (
|
||||
<textarea
|
||||
autoFocus
|
||||
autoFocus={autoFocus}
|
||||
rows={3}
|
||||
name={question.id}
|
||||
id={question.id}
|
||||
|
||||
@@ -12,6 +12,7 @@ interface QuestionConditionalProps {
|
||||
onSubmit: (data: { [x: string]: any }) => void;
|
||||
lastQuestion: boolean;
|
||||
brandColor: string;
|
||||
autoFocus: boolean;
|
||||
}
|
||||
|
||||
export default function QuestionConditional({
|
||||
@@ -19,6 +20,7 @@ export default function QuestionConditional({
|
||||
onSubmit,
|
||||
lastQuestion,
|
||||
brandColor,
|
||||
autoFocus,
|
||||
}: QuestionConditionalProps) {
|
||||
return question.type === QuestionType.OpenText ? (
|
||||
<OpenTextQuestion
|
||||
@@ -26,6 +28,7 @@ export default function QuestionConditional({
|
||||
onSubmit={onSubmit}
|
||||
lastQuestion={lastQuestion}
|
||||
brandColor={brandColor}
|
||||
autoFocus={autoFocus}
|
||||
/>
|
||||
) : question.type === QuestionType.MultipleChoiceSingle ? (
|
||||
<MultipleChoiceSingleQuestion
|
||||
|
||||
Reference in New Issue
Block a user