primer / css

Primer is GitHub's design system. This is the CSS implementation
https://primer.style/css
MIT License
12.56k stars 1.21k forks source link

Support GFM task-lists #1149

Closed seshrs closed 1 year ago

seshrs commented 4 years ago

Is your feature request related to a problem? Please describe. GitHub Flavored Markdown (GFM) defines task lists as unordered lists with disabled checkbox "bullets".

The HTML to render such a task-list (as generated by Kramdown GFM parser) is as follows:

<ul class="task-list">
  <li class="task-list-item"><input type="checkbox" class="task-list-item-checkbox" disabled="disabled" />Here is an unchecked task list item.</li>
  <li class="task-list-item"><input type="checkbox" class="task-list-item-checkbox" disabled="disabled" checked="checked" />And here is a checked task list item.</li>
  <li class="task-list-item"><input type="checkbox" class="task-list-item-checkbox" disabled="disabled" />Another unchecked item.</li>
</ul>

On GitHub-managed sites like on github.com, task lists are rendered as expected, as lists with checkboxes:

Compare the above with a task-list using Primer CSS styles. Notice how the list-style is still disc, and the spacing is incorrect. image

I couldn't find references to any styles for task-lists in Primer CSS. Most significantly, this affects task-list styling on pages-themes/primer, which is the default theme for GitHub Pages.

Describe the solution you'd like I found that the following rules style task-lists decently. (I derived this based on style rules from github.com.)

li.task-list-item {
  list-style-type: none;
}
li.task-list-item .task-list-item-checkbox {
  margin: 0 0.2em 0.25em -1.6em;
}

I imagine that the styles would have to be refined before being included in Primer CSS, while also taking into account accessibility (see https://developer.mozilla.org/en-US/docs/Web/CSS/list-style-type#Accessibility_concerns).

I'm not sure if the task-list-item and task-list-item-checkbox classes are appropriate. If Primer CSS prefers to use different class names, I guess Kramdown GFM parser can add an option to match the class-names.

Additional context CC @zpapanas who first noticed the issue (fixed in a project I maintain: eecs485staff/primer-spec#68)

simurai commented 4 years ago

I couldn't find references to any styles for task-lists in Primer CSS.

Currently the styling for .task-list-item is only available on github.com. But if this is something that would be useful to have in Primer CSS, we could consider moving the styles. 👍

github-actions[bot] commented 3 years ago

Hi! This issue has been marked as stale because it has been open with no activity for 180 days. You can comment on the issue or remove the stale label to keep it open. If you do nothing, this issue will be closed in 7 days.

seshrs commented 3 years ago

Ping to keep this alive! CC @simurai

github-actions[bot] commented 2 years ago

Hi! This issue has been marked as stale because it has been open with no activity for 180 days. You can comment on the issue or remove the stale label to keep it open. If you do nothing, this issue will be closed in 7 days.

seshrs commented 2 years ago

Ping (again) to keep the task open!

github-actions[bot] commented 2 years ago

Hi! This issue has been marked as stale because it has been open with no activity for 180 days. You can comment on the issue or remove the stale label to keep it open. If you do nothing, this issue will be closed in 7 days.

simurai commented 2 years ago

I think still not fixed.

github-actions[bot] commented 1 year ago

Hi! This issue has been marked as stale because it has been open with no activity for 180 days. You can comment on the issue or remove the stale label to keep it open. If you do nothing, this issue will be closed in 7 days.