From e73f13a76f21fd725291013782750b064f33de43 Mon Sep 17 00:00:00 2001 From: adyh Date: Fri, 16 Aug 2024 11:46:52 +0100 Subject: [PATCH 1/3] fix(surveys): #23937 disables interactivity on templates, fixes click targets --- frontend/src/custom.d.ts | 8 +++++ .../src/scenes/surveys/SurveyTemplates.scss | 6 ++++ .../src/scenes/surveys/SurveyTemplates.tsx | 35 +++++++++++-------- 3 files changed, 34 insertions(+), 15 deletions(-) diff --git a/frontend/src/custom.d.ts b/frontend/src/custom.d.ts index 9d12347aede4d..712dd070fbade 100644 --- a/frontend/src/custom.d.ts +++ b/frontend/src/custom.d.ts @@ -1,3 +1,5 @@ +import 'react' + // This fixes TS errors when importing a .svg file declare module '*.svg' { const content: any @@ -21,3 +23,9 @@ declare module '*.lottie' { const content: any export default content } + +declare module 'react' { + interface HTMLAttributes extends AriaAttributes, DOMAttributes { + inert?: '' + } +} diff --git a/frontend/src/scenes/surveys/SurveyTemplates.scss b/frontend/src/scenes/surveys/SurveyTemplates.scss index 29dd242f597e7..daaec9f49470b 100644 --- a/frontend/src/scenes/surveys/SurveyTemplates.scss +++ b/frontend/src/scenes/surveys/SurveyTemplates.scss @@ -14,7 +14,13 @@ border-color: var(--primary-3000-hover); } + &:focus { + border-color: var(--primary-3000-hover); + outline: none; + } + .SurveyTemplate { + pointer-events: none; transform: scale(0.8, 0.8); } } diff --git a/frontend/src/scenes/surveys/SurveyTemplates.tsx b/frontend/src/scenes/surveys/SurveyTemplates.tsx index 1b63a1a9cb52a..0d3c35c53037a 100644 --- a/frontend/src/scenes/surveys/SurveyTemplates.tsx +++ b/frontend/src/scenes/surveys/SurveyTemplates.tsx @@ -33,27 +33,32 @@ export function SurveyTemplates(): JSX.Element {
{defaultSurveyTemplates.map((template, idx) => { return ( -
{ - setSurveyTemplateValues({ - name: template.templateType, - questions: template.questions, - appearance: { ...defaultSurveyAppearance, ...template.appearance }, - }) - reportSurveyTemplateClicked(template.templateType) - }} - > +
{template.templateType} {template.description} -
-
+
{ + setSurveyTemplateValues({ + name: template.templateType, + questions: template.questions, + appearance: { ...defaultSurveyAppearance, ...template.appearance }, + }) + reportSurveyTemplateClicked(template.templateType) + }} + onKeyDown={(event) => { + if (event.key === 'Enter') { + event.currentTarget.click() + } + }} + > +
Date: Fri, 16 Aug 2024 14:04:37 +0100 Subject: [PATCH 2/3] fix(surveys): #23937 updates tabIndex to 0 --- frontend/src/scenes/surveys/SurveyTemplates.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/scenes/surveys/SurveyTemplates.tsx b/frontend/src/scenes/surveys/SurveyTemplates.tsx index 0d3c35c53037a..d24713f9b877f 100644 --- a/frontend/src/scenes/surveys/SurveyTemplates.tsx +++ b/frontend/src/scenes/surveys/SurveyTemplates.tsx @@ -42,7 +42,7 @@ export function SurveyTemplates(): JSX.Element {
{ setSurveyTemplateValues({ From 26403c6476acdbf2ba95a0379d208a4b6d44ebc3 Mon Sep 17 00:00:00 2001 From: adyh Date: Tue, 20 Aug 2024 11:17:11 +0100 Subject: [PATCH 3/3] #23937 reverts inert attribute --- frontend/src/custom.d.ts | 8 -------- frontend/src/scenes/surveys/SurveyTemplates.tsx | 4 ++-- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/frontend/src/custom.d.ts b/frontend/src/custom.d.ts index 712dd070fbade..9d12347aede4d 100644 --- a/frontend/src/custom.d.ts +++ b/frontend/src/custom.d.ts @@ -1,5 +1,3 @@ -import 'react' - // This fixes TS errors when importing a .svg file declare module '*.svg' { const content: any @@ -23,9 +21,3 @@ declare module '*.lottie' { const content: any export default content } - -declare module 'react' { - interface HTMLAttributes extends AriaAttributes, DOMAttributes { - inert?: '' - } -} diff --git a/frontend/src/scenes/surveys/SurveyTemplates.tsx b/frontend/src/scenes/surveys/SurveyTemplates.tsx index d24713f9b877f..266bac2bfcbef 100644 --- a/frontend/src/scenes/surveys/SurveyTemplates.tsx +++ b/frontend/src/scenes/surveys/SurveyTemplates.tsx @@ -42,7 +42,7 @@ export function SurveyTemplates(): JSX.Element {
{ setSurveyTemplateValues({ @@ -58,7 +58,7 @@ export function SurveyTemplates(): JSX.Element { } }} > -
+