flatpickr icon indicating copy to clipboard operation
flatpickr copied to clipboard

Font Weight Accessibility Issue

Open stephenmcghee opened this issue 9 years ago • 3 comments

Flatpickr fails when using an accessibility checker. In my case, the checker i'm using is "Sort Site by PowerMapper" which uses WCAG 2.0 Level A rules, and this is happening on several sites that use flatpickr.

The accessibility issue is

"Use semantic markup like STRONG instead of using the CSS font-weight property. Use the STRONG element instead of the SPAN element for bold text."

https://www.w3.org/TR/WCAG20-TECHS/F2.html

This is a bit of a silly issue, but you would need to replace all the span elements that contain font-weight: bold (.flatpickr-current-month span.cur-month, .flatpickr-weekday), with strong elements OR modify the CSS.

As a temporary fix for this, in the CSS file, I've just replaced all instances of font-weight: bold, with font-weight: 400, and added text-shadows to them so they appear bold.

That way flatpickr passes accessibility...

Your Environment

  • flatpickr version used: 3.0.6
  • Browser name and version: Chrome 60.0.3112.101
  • OS and version: Windows 10

stephenmcghee avatar Aug 23 '17 18:08 stephenmcghee

This doesn't really make sense because the <strong> element is intended to convey strong importance usually depicted in bold text, whereas bold text using font-weight is only an appearance property with additional meaning/emphasis.

Barring machine learning, an accessibility tool would not be capable of knowing whether the text is supposed to be important or just visually distinct (bold).

See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/strong#Bold_vs._Strong

RinkAttendant6 avatar Aug 29 '17 22:08 RinkAttendant6

Yea its a really strange issue, but it did fix itself when I changed the font-weight in the stylesheet. So it must be capable of knowing. And the issue is still valid as seen on the w3 site...

stephenmcghee avatar Sep 05 '17 18:09 stephenmcghee

Hello,

As mentioned earlier, the font-weight is there simply for visual purposes, rather than emphasis. While there's work to be done regarding accessibility (which for me is not just a "feature", but a requirement), I consider this a non-issue.

But thank you for raising concern about it regardless!

chmln avatar Oct 14 '17 18:10 chmln