Skip to content

Commit d72d475

Browse files
author
Christian Stuff
committed
Issue #2505 - Custom checkbox & flexbox order to move checked labels up
1 parent 9ff5a69 commit d72d475

File tree

2 files changed

+31
-8
lines changed

2 files changed

+31
-8
lines changed

webcompat/static/css/src/label-editor.css

+24-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333

3434
/* list category */
3535
.label-editor-list {
36+
display: flex;
37+
flex-direction: column;
3638
max-height: 18.75em;
3739
-webkit-overflow-scrolling: touch;
3840
overflow-x: hidden;
@@ -52,9 +54,22 @@
5254
cursor: pointer;
5355
display: block;
5456
margin: 0;
57+
order: 2;
5558
padding: calc(var(--unit-space) * .75) calc(var(--unit-space) * .5);
5659
}
5760

61+
.label-editor-list-item .small {
62+
vertical-align: middle;
63+
}
64+
65+
.label-editor-list-item::before {
66+
content: "☐";
67+
display: inline-block;
68+
font-size: 1.5em;
69+
margin-top: -4px;
70+
vertical-align: middle;
71+
}
72+
5873
.label-editor-list-item:last-child {
5974
border-bottom: 1px solid #ddd;
6075
}
@@ -70,8 +85,15 @@
7085

7186
/* checkbox */
7287
.label-editor-list-item-checkbox {
73-
margin: 0;
74-
padding: 0;
88+
display: none;
89+
}
90+
91+
.label-editor-list-item-checkbox:checked + .label-editor-list-item::before {
92+
content: "︎☑︎";
93+
}
94+
95+
.label-editor-list-item-checkbox:checked + .label-editor-list-item {
96+
order: 1;
7597
}
7698

7799
/* Launch Category Editor */

webcompat/templates/web_modules/label-editor.jst

+7-6
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@
1111
</div>
1212
<div class="label-editor-list" tabindex="-1">
1313
<% _.each(labels, function(label) { %>
14-
<label class="label-editor-list-item label-<%= label.remoteName %>" tabindex="0">
15-
<input class="label-editor-list-item-checkbox"
16-
type="checkbox" name="<%= label.name %>"
17-
data-color="<%=label.color%>"
18-
data-remotename="<%= label.remoteName %>"
19-
tabindex="-1">
14+
<input class="label-editor-list-item-checkbox"
15+
type="checkbox" name="<%= label.name %>"
16+
id="label-<%= label.remoteName %>"
17+
data-color="<%=label.color%>"
18+
data-remotename="<%= label.remoteName %>"
19+
tabindex="-1">
20+
<label class="label-editor-list-item label-<%= label.remoteName %>" for="label-<%= label.remoteName %>" tabindex="0">
2021
<span class="small"><%= label.name %></span>
2122
</label>
2223
<% }); %>

0 commit comments

Comments
 (0)