reactjs / react-a11y

Identifies accessibility issues in your React.js elements
MIT License
2.34k stars 126 forks source link

Using a11y with preact and preact-cli #156

Open PatchOnKnee opened 5 years ago

PatchOnKnee commented 5 years ago

Hi currently trying to integrate a11y into a preact app, with preact-cli also installed. preact-cli provides aliases for the React and ReactDOM components and allows the use of normal react components with preact.

The issue arises after implementing a11y. No errors are thrown as React and ReactDOM are imported as per normal, and a11y as per the usage section of the github page. After running the live reload server with "npm run start", no warnings or errors are throw even with the inclusion of a fault element as per the a11y docs.

I've provided the app.js code in this paste bin, which can simply be placed into the default app.js after creating a preact project using the command "preact create default test-project".

erin-doyle commented 5 years ago

I certainly have not tried using this library in a preact project before and I'm not sure if others have been able to successfully. So yes it's possible it's not currently compatible. I'll look into it and see what we need to do to provide compatibility.

erin-doyle commented 5 years ago

I did some work on looking in to this and no react-a11y is not compatible with Preact out of the box. I did not test it but I'm guessing it might work if you use preact-compat. I have started working on updating react-a11y to be fully compatible with Preact but in the meantime trying preact-compat might be helpful.