You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using markdown for making a tasks list, the checkboxes labels aren't parsed as labels but text nodes.
This is semantically incorrect, the text for each checkbox should be a <label> with the appropriate for and id. Not only it allows screen readers to announce what the checkbox actually means, but it also allows you to click on the label to select the checkbox (even if in this case it's not an option we want to give the user given the markdown conversion).
This bug is reported by Google Lighthouse (dev tools) when running accessibility assessment. It's also reported in other reputed accessibility tools.
Markdown used
Here are checkboxes
-[x] Checkbox on
-[ ] Checkbox off
Current HTML output
<ul><li><inputtype="checkbox" readonly="" checked="">
Checkbox on
</li><li><inputtype="checkbox" readonly="">
Checkbox off
</li></ul>
As you can see, it's rendering the checkbox text as a DOM Text Node instead of a <label>.
Given the <label> is directly linked to the checkbox, the default rendering for this <label> should probably done in the checkbox rendering function.
Not only does it makes it easier to link the id and the for attributes together, but it would also allow an easier time for users when they use component overrides.
Simply passing the text as a prop to the checkbox override would be sufficient. Semantically speaking, there shouldn't be any HTML element within the <label> from the markdown conversion, making it a simple string.
The text was updated successfully, but these errors were encountered:
TheThirdRace
changed the title
GFM checkboxes are semantically incorrect
GFM checkboxes are semantically incorrect, they need a small adjustment
Feb 6, 2021
TheThirdRace
changed the title
GFM checkboxes are semantically incorrect, they need a small adjustment
GFM checkboxes need a small adjustment to make them semantically correct
Feb 6, 2021
Description of the bug
When using markdown for making a tasks list, the checkboxes labels aren't parsed as labels but text nodes.
This is semantically incorrect, the text for each checkbox should be a
<label>
with the appropriatefor
andid
. Not only it allows screen readers to announce what the checkbox actually means, but it also allows you to click on the label to select the checkbox (even if in this case it's not an option we want to give the user given the markdown conversion).This bug is reported by Google Lighthouse (dev tools) when running accessibility assessment. It's also reported in other reputed accessibility tools.
Markdown used
Current HTML output
As you can see, it's rendering the checkbox text as a
DOM Text Node
instead of a<label>
.HTML ouput expected
Possible improvement
Given the
<label>
is directly linked to the checkbox, the default rendering for this<label>
should probably done in the checkbox rendering function.Not only does it makes it easier to link the
id
and thefor
attributes together, but it would also allow an easier time for users when they use component overrides.Simply passing the text as a prop to the checkbox override would be sufficient. Semantically speaking, there shouldn't be any HTML element within the
<label>
from the markdown conversion, making it a simple string.The text was updated successfully, but these errors were encountered: