19
19
-
20
20
-->
21
21
<template>
22
- <li class="predefined-status"
23
- tabindex="0"
24
- role="radio"
25
- :aria-checked="`${selected}`"
26
- @keyup.enter="select"
27
- @keyup.space="select"
28
- @click="select">
29
- <span aria-hidden="true" class="predefined-status__icon">
30
- {{ icon }}
31
- </span>
32
- <span class="predefined-status__message">
33
- {{ message }}
34
- </span>
35
- <span class="predefined-status__clear-at">
36
- {{ clearAt | clearAtFilter }}
37
- </span>
22
+ <li class="predefined-status">
23
+ <input :id="id"
24
+ class="predefined-status__input"
25
+ type="radio"
26
+ name="predefined-status"
27
+ :checked="selected"
28
+ @change="select">
29
+ <label class="predefined-status__label" :for="id">
30
+ <span aria-hidden="true" class="predefined-status__label--icon">
31
+ {{ icon }}
32
+ </span>
33
+ <span class="predefined-status__label--message">
34
+ {{ message }}
35
+ </span>
36
+ <span class="predefined-status__label--clear-at">
37
+ {{ clearAt | clearAtFilter }}
38
+ </span>
39
+ </label>
38
40
</li>
39
41
</template>
40
42
@@ -70,6 +72,11 @@ export default {
70
72
default: false,
71
73
},
72
74
},
75
+ computed: {
76
+ id() {
77
+ return `user-status-predefined-status-${this.messageId}`
78
+ },
79
+ },
73
80
methods: {
74
81
/**
75
82
* Emits an event when the user clicks the row
@@ -83,39 +90,52 @@ export default {
83
90
84
91
<style lang="scss" scoped>
85
92
.predefined-status {
86
- display: flex;
87
- flex-wrap: nowrap;
88
- justify-content: flex-start;
89
- flex-basis: 100%;
90
- border-radius: var(--border-radius);
91
- align-items: center;
92
- min-height: 44px;
93
+ &__label {
94
+ display: flex;
95
+ flex-wrap: nowrap;
96
+ justify-content: flex-start;
97
+ flex-basis: 100%;
98
+ border-radius: var(--border-radius);
99
+ align-items: center;
100
+ min-height: 44px;
93
101
94
- &:hover,
95
- &:focus {
96
- background-color: var(--color-background-hover) ;
97
- }
102
+ &--icon {
103
+ flex-basis: 40px;
104
+ text-align: center ;
105
+ }
98
106
99
- &:active{
100
- background-color: var(--color-background-dark);
101
- }
107
+ &--message {
108
+ font-weight: bold;
109
+ padding: 0 6px;
110
+ }
111
+
112
+ &--clear-at {
113
+ color: var(--color-text-maxcontrast);
102
114
103
- &__icon {
104
- flex-basis: 40px;
105
- text-align: center;
115
+ &::before {
116
+ content: ' – ';
117
+ }
118
+ }
106
119
}
107
120
108
- &__message {
109
- font-weight: bold;
110
- padding: 0 6px;
121
+ &__input:checked + &__label,
122
+ &__input:focus + &__label,
123
+ &__label:hover {
124
+ background-color: var(--color-background-hover);
111
125
}
112
126
113
- &__clear-at {
114
- color: var(--color-text-maxcontrast);
127
+ &__label:active {
128
+ background-color: var(--color-background-dark);
129
+ }
115
130
116
- &::before {
117
- content: ' – ';
118
- }
131
+ // Inputs are here for keyboard navigation, they are not visually visible
132
+ &__input {
133
+ position: absolute;
134
+ top: auto;
135
+ left: -10000px;
136
+ overflow: hidden;
137
+ width: 1px;
138
+ height: 1px;
119
139
}
120
140
}
121
141
</style>
0 commit comments