knupfer/type-of-html

Writing typed WAI-ARIA compliant HTML

Closed this issue · 2 comments

Hey there,

I love the library and I've been hankering for an excuse to use it for something real. I'm working on a few statically generated websites at the moment and it seemed like the perfect opportunity. Unfortunately, I can't figure out a way to type aria attributes or enter them into the DOM in any way.

As such, html like

...
<body>
  <header role="banner">
    <nav aria-label="site">
...

cannot be expressed in the current library (to the best of my knowledge) without resorting to sticking vast amounts of text into Raw constructors. Are there any plans to support WAI-ARIA or is it beyond the scope of the library?

Edit:
Related/tangential issue: Escape hatches consume the entire node.

You can use Raw for any node, but then (as far as I'm aware) the entire rest of the tree and its children have to be in the same Raw constructor too. So if I only need, say, the attributes to be written in an escape hatch, I'm out of luck.

I'd love to be able to write something like

header = header_A (Raw "role=\"banner\") (
  -- rest of typed document continues

instead of

body = body_ (Raw "<header... (entire rest of the html document goes here)

References:

https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques
https://www.w3.org/WAI/standards-guidelines/aria/

So, just published a new version. Your example will now work, every check is now turned off for Raw.

Released a new version with aria support and removing all checks from Raw data. Thanks for reporting!