How to set aria-* attributes
See original GitHub issueHello @yysun, thank you for your effort on building this awesome framework.
The problem I faced is I’m not able to setup aria-* attributes, aria-label in particular with JSX/TSX syntax. What is strange, I’m able to successfully set data-id attribute which is quite similar.
the code to reproduce:
<form role="search"><input type="search" className="hsi" aria-label="Search"/></form>
do not set aria-label attribute.
As I see, the jsx/react namespace is bound to apprun itself which correctly create element structure with all attributes, then somehow it is transformed into DOM element without aria-label;
Can you point me what is wrong.
UPDATE: vdom-my.ts function updateProps(…) just recognize some attributes like data-id, and tries to set others as attributes to DOM element, but desired behaviour should be to add the attribute to internal attributes map . I’m pretty sure I can prepare a pull request with desired code, at least with aria-* subset.
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (9 by maintainers)
Top GitHub Comments
Checking name === ‘role’ in stead of startsWith is fine in this case, but the bigger problem is that other non-standard / custom attributes are still not support. I was thinking perhaps it should use setAttribute in all cases instead of assigned the value to element property.
However, I am not sure if there is any limitation and performance issue with setAttribute , because the value parameter is alwsays string.
The camel case for data- attributes fix is in v1.15.2