Skip to content

Commit 9742eef

Browse files
authored
Merge pull request #2521 from /issues/2505
Issue #2505 - Custom checkbox & flexbox order to move checked labels up
2 parents b640338 + df4d162 commit 9742eef

File tree

3 files changed

+37
-8
lines changed

3 files changed

+37
-8
lines changed

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

+29-1
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
}
@@ -64,14 +79,27 @@
6479
.label-editor-list-item.focused {
6580
border-color: Highlight;
6681
border-style: solid;
67-
border-width: 2px;
82+
border-width: 2px 2px 2px 4px;
6883
outline: none;
6984
}
7085

7186
/* checkbox */
7287
.label-editor-list-item-checkbox {
88+
clip: rect(0 0 0 0);
89+
height: 0;
7390
margin: 0;
7491
padding: 0;
92+
position: absolute;
93+
visibility: hidden;
94+
width: 0;
95+
}
96+
97+
.label-editor-list-item-checkbox:checked + .label-editor-list-item::before {
98+
content: "︎☑︎";
99+
}
100+
101+
.label-editor-list-item-checkbox:checked + .label-editor-list-item {
102+
order: 1;
75103
}
76104

77105
/* Launch Category Editor */

webcompat/static/js/lib/editor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ issues.CategoryEditorView = Backbone.View.extend({
118118
// hide the non-filter matches
119119
_.each(toHide, function(name) {
120120
$("input[name=" + escape(name) + "]")
121-
.closest(".label-editor-list-item")
121+
.next(".label-editor-list-item")
122122
.hide();
123123
});
124124
}, 100),

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)