Skip to content

Commit a59f30d

Browse files
committed
Merge branch 'button-fixes'
# Conflicts: # src/components/Question.vue
2 parents 2af0120 + ed79e0a commit a59f30d

File tree

6 files changed

+102
-70
lines changed

6 files changed

+102
-70
lines changed

examples/questionnaire/Example.vue

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,22 @@
3737

3838
<!-- We've overriden the default "completeButton" slot content -->
3939
<template v-slot:completeButton>
40-
<a
41-
ref="button"
42-
href="#"
43-
v-on:click.prevent="onSendData()"
44-
v-if="!submitted"
45-
role="button"
46-
aria-label="Press to submit"
47-
>
48-
<div class="o-btn-action">
49-
<span>{{ language.submitText }}</span>
50-
</div>
51-
52-
<span class="f-enter-desc">{{ language.pressEnter }}</span>
53-
</a>
40+
<div class="f-submit" v-if="!submitted">
41+
<button
42+
class="o-btn-action"
43+
ref="button"
44+
type="submit"
45+
href="#"
46+
v-on:click.prevent="onSendData()"
47+
aria-label="Press to submit"
48+
>
49+
<span>{{ language.submitText }}</span>
50+
</button>
51+
<a class="f-enter-desc"
52+
href="#"
53+
v-on:click.prevent="onSendData()">
54+
{{ language.pressEnter }}</a>
55+
</div>
5456

5557
<p class="text-success" v-if="submitted">Submitted succesfully.</p>
5658
</template>

examples/quiz/Example.vue

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,22 @@
3535

3636
<!-- We've overriden the default "completeButton" slot content -->
3737
<template v-slot:completeButton>
38-
<a
39-
ref="button"
40-
href="#"
41-
v-on:click.prevent="onQuizSubmit()"
42-
v-if="!submitted"
43-
>
44-
<div class="o-btn-action">
38+
<div class="f-submit" v-if="!submitted">
39+
<button
40+
class="o-btn-action"
41+
ref="button"
42+
type="submit"
43+
href="#"
44+
v-on:click.prevent="onQuizSubmit()"
45+
aria-label="Press to submit">
4546
<span>Calculate score</span>
46-
</div>
47-
48-
<span class="f-enter-desc">{{ language.pressEnter }}</span>
49-
</a>
50-
47+
</button>
48+
<a
49+
class="f-enter-desc"
50+
href="#"
51+
v-on:click.prevent="onQuizSubmit()">
52+
{{ language.pressEnter }}</a>
53+
</div>
5154
<p class="text-success" v-if="submitted && score < 4">"You scored {{ score }} out of {{ total }}. There's a lot of room for improvement."</p>
5255
<p class="text-success" v-else-if="submitted && score < 7">"You scored {{ score }} out of {{ total }}. Not bad at all!"</p>
5356
<p class="text-success" v-else-if="submitted && score <= total">"You scored {{ score }} out of {{ total }}. Wow, that's impressive!"</p>

src/assets/css/common.css

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -131,16 +131,30 @@ svg.logo {
131131
opacity: 1;
132132
}
133133

134+
.v-form button,
135+
.v-form input {
136+
-webkit-appearance: none;
137+
overflow: visible;
138+
}
139+
134140
/*buttons*/
135-
.o-btn-action {
136-
z-index: 1;
141+
142+
/*default button*/
143+
.v-form button {
144+
border: none;
145+
outline: 0;
137146
cursor: pointer;
138-
padding: 0 1.4rem 0;
139-
margin-bottom: 20px;
147+
padding: 0.6rem 1.4rem;
140148
text-align: center;
141149
display: inline-block;
142-
line-height: 45px;
143-
height: 44px;
150+
min-height: 44px;
151+
white-space: pre-wrap;
152+
max-width: 100%;
153+
}
154+
155+
.o-btn-action {
156+
z-index: 1;
157+
line-height: 1.2;
144158
font-weight: 900;
145159
text-transform: lowercase;
146160
}
@@ -153,7 +167,13 @@ svg.logo {
153167
}
154168

155169
.f-enter-desc {
170+
display: inline-block;
156171
margin-left: 0.6rem;
172+
margin-top: 0.6rem;
173+
}
174+
175+
.f-enter {
176+
margin-bottom: 20px;
157177
}
158178

159179
/*v-form*/
@@ -248,12 +268,6 @@ span.faux-form {
248268
resize: vertical;
249269
}
250270

251-
.v-form button,
252-
.v-form input {
253-
-webkit-appearance: none;
254-
overflow: visible;
255-
}
256-
257271
.v-form .full-width input[type=text],
258272
.v-form .full-width input[type=number],
259273
.v-form .full-width input[type=tel],
@@ -536,6 +550,10 @@ a.f-disabled {
536550
max-width: 760px;
537551
}
538552

553+
f.submit {
554+
margin-bottom: 20px;
555+
}
556+
539557
/*
540558
media-start
541559
*/
@@ -637,11 +655,6 @@ a.f-disabled {
637655
font-size: .9rem;
638656
}
639657

640-
.o-btn-action {
641-
line-height: 40px;
642-
height: 40px;
643-
}
644-
645658
.field-sectionbreaktype p {
646659
font-size: 1rem;
647660
}

src/assets/css/themes/theme-minimal.css

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ span.f-answered{
118118
}
119119

120120
/*buttons*/
121+
121122
.o-btn-action {
122123
color: var(--bg-color);
123124
background-color: var(--main-text-color);
@@ -127,7 +128,7 @@ span.f-answered{
127128
.o-btn-action:focus {
128129
background-color: var(--main-text-color);
129130
opacity: .9;
130-
}
131+
}
131132

132133
/*footer*/
133134
.f-footer .footer-inner-wrap{
@@ -136,7 +137,7 @@ span.f-answered{
136137

137138
@media screen and (max-width:479px) {
138139
.f-footer .footer-inner-wrap{
139-
background-color: rgba(0,0,0,0.05);
140+
background-color: rgba(180,180,180,0.15);
140141
}
141142

142143
}
@@ -160,7 +161,9 @@ span.f-answered{
160161
}
161162

162163
.f-prev:hover,
163-
.f-next:hover{
164+
.f-next:hover,
165+
.f-prev:focus,
166+
.f-next:focus{
164167
background-color: rgba(0,0,0,0.07);
165168
}
166169

src/components/FlowForm.vue

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,22 @@
2929

3030
<slot name="completeButton">
3131
<!-- Default content for the "completeButton" slot -->
32-
<a ref="button" href="#" v-on:click.prevent="submit()" v-if="!submitted" role="button" v-bind:aria-label="language.ariaSubmitText">
33-
<div class="o-btn-action">
32+
<button
33+
class="o-btn-action"
34+
ref="button"
35+
type="button"
36+
href="#"
37+
v-on:click.prevent="submit()"
38+
v-if="!submitted"
39+
v-bind:aria-label="language.ariaSubmitText">
3440
<span>{{ language.submitText }}</span>
35-
</div>
36-
37-
<span class="f-enter-desc">{{ language.pressEnter }}</span>
38-
</a>
41+
</button>
42+
<a
43+
class="f-enter-desc"
44+
href="#"
45+
v-on:click.prevent="submit()"
46+
v-if="!submitted">
47+
{{ language.pressEnter }}</a>
3948
</slot>
4049
</div>
4150
</div>

src/components/Question.vue

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,25 @@
5050
</div>
5151
<p v-if="question.description" class="description">{{ question.description }}</p>
5252
</div>
53-
54-
<a
55-
class="animate fade-in-up f-enter"
56-
ref="button"
57-
href="#"
58-
v-if="showOkButton()"
59-
v-on:click.prevent="onEnter"
60-
role ="button"
61-
v-bind:aria-label="language.ariaOk"
62-
>
63-
<div class="o-btn-action">
64-
<span v-if="question.type === QuestionType.SectionBreak">{{ language.continue }}</span>
65-
<span v-else>{{ language.ok }}</span>
66-
</div>
67-
68-
<span class="f-enter-desc" v-if="question.type !== QuestionType.LongText || !isMobile">{{ language.pressEnter }}</span>
69-
</a>
53+
<div class="animate fade-in f-enter" v-if="showOkButton()">
54+
<button
55+
class="o-btn-action"
56+
type="button"
57+
ref="button"
58+
href="#"
59+
v-on:click.prevent="onEnter"
60+
v-bind:aria-label="language.ariaOk"
61+
>
62+
<span v-if="question.type === QuestionType.SectionBreak">{{ language.continue }}</span>
63+
<span v-else>{{ language.ok }}</span>
64+
</button>
65+
<a
66+
class="f-enter-desc"
67+
href="#"
68+
v-if="question.type !== QuestionType.LongText || !isMobile"
69+
v-on:click.prevent="onEnter">
70+
{{ language.pressEnter }}</a>
71+
</div>
7072

7173
<div v-if="showInvalid()" class="f-invalid" role="alert" aria-live="assertive">{{ language.invalidPrompt }}</div>
7274
</div>
@@ -238,4 +240,4 @@
238240
}
239241
}
240242
}
241-
</script>
243+
</script>

0 commit comments

Comments
 (0)