Skip to content

Commit ae4fdbf

Browse files
committed
Generate ARIA props
For now, they are all given the `String` type. After spot checking a few on MDN, that is mostly accurate, even for seemingly numeric values such `aria-valuemin`: https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaValueMin#value NOTE: Despite React using `camelCase` for most props, ARIA props are indeed `kebab-case`: - https://react.dev/learn/writing-markup-with-jsx#3-camelcase-salls-most-of-the-things:~:text=the%20browser%20console.-,Pitfall,-For%20historical%20reasons - https://legacy.reactjs.org/docs/accessibility.html#wai-aria This could be improved with the following type definitions, but we’ll leave this to the implementing developer now to check support in the browser: https://use-form.netlify.app/interfaces/_node_modules__types_react_index_d_.react.ariaattributes
1 parent cfed589 commit ae4fdbf

File tree

2 files changed

+6022
-1
lines changed

2 files changed

+6022
-1
lines changed

codegen/html.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { props, voids, types, typesByElement, reserved } = require("./consts")
1+
const { ariaProps, props, voids, types, typesByElement, reserved } = require("./consts")
22

33
module.exports = () => ({
44
path: "Elmish/HTML/Generated.purs",
@@ -36,6 +36,9 @@ const printRow = (e, elProps) =>
3636
elProps.length > 0
3737
? `
3838
( _data :: Object String
39+
-- ARIA
40+
, ${ariaProps.map(p => `${p} :: String`).join("\n , ")}
41+
-- Props
3942
, ${elProps.map(p => `${p} :: ${propType(e, p)}`).join("\n , ")}
4043
)`
4144
: "()"

0 commit comments

Comments
 (0)