Skip to content

Commit

Permalink
✨ not show brown outline until user interact with form
Browse files Browse the repository at this point in the history
  • Loading branch information
keithCuniah committed Jul 31, 2023
1 parent 6584f78 commit 5432e57
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<form
id="formId"
class="questions-form"
:class="{ '--focused-form': formHasFocus }"
:class="{ '--focused-form': formHasFocus && interactionCount > 1 }"
@submit.prevent="onSubmit"
v-click-outside="onClickOutside"
>
Expand Down Expand Up @@ -148,12 +148,16 @@ export default {
return {
originalRecord: null,
autofocusPosition: 0,
interactionCount: 0,
};
},
setup() {
return useQuestionFormViewModel();
},
computed: {
showOutline() {
return this.formHasFocus && !this.isFormUntouched;
},
formHasFocus() {
if (this.autofocusPosition || this.autofocusPosition == 0) return true;
return false;
Expand Down Expand Up @@ -325,6 +329,7 @@ export default {
return this.record.isPending && index === this.autofocusPosition;
},
updateQuestionAutofocus(index) {
this.interactionCount++;
this.autofocusPosition = Math.min(
this.numberOfQuestions - 1,
Math.max(0, index)
Expand Down

0 comments on commit 5432e57

Please sign in to comment.