mirror of
https://github.com/gohugoio/hugo.git
synced 2024-05-11 05:54:58 +00:00
Render task list item inside label for correct accessibility
Fixes #3303
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
0abdeeef67
commit
c8257f8b72
@@ -50,10 +50,12 @@ func (r *HugoHTMLRenderer) ListItem(out *bytes.Buffer, text []byte, flags int) {
|
||||
|
||||
switch {
|
||||
case bytes.HasPrefix(text, []byte("[ ] ")):
|
||||
text = append([]byte(`<input type="checkbox" disabled class="task-list-item">`), text[3:]...)
|
||||
text = append([]byte(`<label><input type="checkbox" disabled class="task-list-item">`), text[3:]...)
|
||||
text = append(text, []byte(`</label>`)...)
|
||||
|
||||
case bytes.HasPrefix(text, []byte("[x] ")) || bytes.HasPrefix(text, []byte("[X] ")):
|
||||
text = append([]byte(`<input type="checkbox" checked disabled class="task-list-item">`), text[3:]...)
|
||||
text = append([]byte(`<label><input type="checkbox" checked disabled class="task-list-item">`), text[3:]...)
|
||||
text = append(text, []byte(`</label>`)...)
|
||||
}
|
||||
|
||||
r.Renderer.ListItem(out, text, flags)
|
||||
|
Reference in New Issue
Block a user