Skip to content

Commit a6f4024

Browse files
committed
Fix issues with QuestionType.Date focus states
1 parent 744de61 commit a6f4024

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

src/components/FlowForm.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,11 +386,11 @@
386386
this.goToPreviousQuestion()
387387
}
388388
} else {
389-
e.preventDefault()
390-
391389
const q = this.activeQuestionComponent()
392390
393391
if (q.shouldFocus()) {
392+
e.preventDefault()
393+
394394
q.focusField()
395395
} else {
396396
e.stopPropagation()

src/components/Question.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202
onTab($event) {
203203
const q = this.$refs.questionComponent
204204
205-
if (q) {
205+
if (q && this.question.type !== QuestionType.Date) {
206206
this.returnFocus()
207207
this.$emit('answer', q)
208208

src/components/QuestionTypes/BaseType.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,11 @@
7171
},
7272
7373
focus() {
74-
const el = this.getElement()
74+
if (!this.focused) {
75+
const el = this.getElement()
7576
76-
el && el.focus()
77+
el && el.focus()
78+
}
7779
},
7880
7981
blur() {

src/components/QuestionTypes/DateType.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,17 @@
1414
name: QuestionType.Date,
1515
data() {
1616
return {
17-
inputType: 'date',
18-
canReceiveFocus: true
17+
inputType: 'date'
1918
}
2019
},
2120
methods: {
2221
validate() {
2322
if (this.question.min && this.dataValue < this.question.min) {
24-
return false
23+
return false
2524
}
2625
2726
if (this.question.max && this.dataValue > this.question.max) {
28-
return false
27+
return false
2928
}
3029
3130
return !this.question.required || this.hasValue

0 commit comments

Comments
 (0)