Skip to content

Commit edfcdde

Browse files
Copilotalexr00
andauthored
Render visible checkmark on checked task list checkboxes
Agent-Logs-Url: https://github.com/microsoft/vscode-pull-request-github/sessions/eea637d3-2de0-4c58-bd80-e2dbde889fdc Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent 58bc1ef commit edfcdde

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

webviews/common/common.css

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,32 @@ input[type='checkbox']:checked {
166166
opacity: 1;
167167
}
168168

169+
/*
170+
* Task list items rendered from markdown (e.g. `- [x] done`) produce
171+
* `<li class="task-list-item"><input type="checkbox" checked disabled> ...</li>`
172+
* without a `.checkbox-wrapper`, so the wrapper-based checkmark above does
173+
* not apply. Pseudo-elements cannot be placed on `<input>` elements, so we
174+
* draw the checkmark on the parent `<li>` using `:has()`, positioned over
175+
* the checkbox.
176+
*/
177+
.task-list-item {
178+
position: relative;
179+
}
180+
181+
.task-list-item:has(> input[type='checkbox']:checked)::before,
182+
.task-list-item:has(> p > input[type='checkbox']:checked)::before {
183+
content: '';
184+
position: absolute;
185+
top: 5px;
186+
left: 6px;
187+
width: 5px;
188+
height: 10px;
189+
border: solid var(--vscode-checkbox-foreground);
190+
border-width: 0 1px 1px 0;
191+
transform: rotate(45deg);
192+
pointer-events: none;
193+
}
194+
169195
input[type='checkbox']:focus {
170196
outline: 1px solid var(--vscode-focusBorder);
171197
outline-offset: 1px;

0 commit comments

Comments
 (0)