Skip to content

Commit 35c8747

Browse files
committed
#96 Implemented standard button elements, added focus styles
1 parent 59d85fc commit 35c8747

File tree

6 files changed

+68
-55
lines changed

6 files changed

+68
-55
lines changed

examples/questionnaire/Example.vue

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,19 @@
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-
40+
<div 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>
5251
<span class="f-enter-desc">{{ language.pressEnter }}</span>
53-
</a>
52+
</div>
5453

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

examples/questionnaire/branding.css

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ span.f-answered{
111111
}
112112

113113
/*buttons*/
114+
114115
.o-btn-action {
115116
color: var(--bg-color);
116117
background-color: var(--main-text-color);
@@ -121,6 +122,9 @@ span.f-answered{
121122
background-color: var(--main-text-color);
122123
opacity: .9;
123124
}
125+
.o-btn-action:focus {
126+
outline: 3px solid #BBEBD5;
127+
}
124128

125129
/*footer*/
126130
.f-footer .footer-inner-wrap{
@@ -153,7 +157,9 @@ span.f-answered{
153157
}
154158

155159
.f-prev:hover,
156-
.f-next:hover{
160+
.f-next:hover,
161+
.f-prev:focus,
162+
.f-next:focus{
157163
background-color: rgba(0,0,0,0.07);
158164
}
159165

examples/quiz/Example.vue

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,18 @@
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 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-
47+
</button>
4848
<span class="f-enter-desc">{{ language.pressEnter }}</span>
49-
</a>
50-
49+
</div>
5150
<p class="text-success" v-if="submitted && score < 4">"You scored {{ score }} out of {{ total }}. There's a lot of room for improvement."</p>
5251
<p class="text-success" v-else-if="submitted && score < 7">"You scored {{ score }} out of {{ total }}. Not bad at all!"</p>
5352
<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: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,28 @@ svg.logo {
130130
opacity: 1;
131131
}
132132

133+
.v-form button,
134+
.v-form input {
135+
-webkit-appearance: none;
136+
overflow: visible;
137+
}
138+
133139
/*buttons*/
134-
.o-btn-action {
135-
z-index: 1;
140+
141+
/*default button*/
142+
.v-form button {
143+
border: none;
144+
outline: 0;
136145
cursor: pointer;
137146
padding: 0 1.4rem 0;
138147
margin-bottom: 20px;
139148
text-align: center;
140149
display: inline-block;
150+
min-height: 44px;
151+
}
152+
153+
.o-btn-action {
154+
z-index: 1;
141155
line-height: 45px;
142156
height: 44px;
143157
font-weight: 900;
@@ -247,12 +261,6 @@ span.faux-form {
247261
resize: vertical;
248262
}
249263

250-
.v-form button,
251-
.v-form input {
252-
-webkit-appearance: none;
253-
overflow: visible;
254-
}
255-
256264
.v-form .full-width input[type=text],
257265
.v-form .full-width input[type=number],
258266
.v-form .full-width input[type=tel],

src/components/FlowForm.vue

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,17 @@
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+
<span class="f-enter-desc">{{ language.pressEnter }}</span>
3943
</slot>
4044
</div>
4145
</div>

src/components/Question.vue

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,20 @@
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-
53+
<div class="animate fade-in-up 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>
6865
<span class="f-enter-desc">{{ language.pressEnter }}</span>
69-
</a>
66+
</div>
7067

7168
<div v-if="showInvalid()" class="f-invalid" role="alert" aria-live="assertive">{{ language.invalidPrompt }}</div>
7269
</div>

0 commit comments

Comments
 (0)