preactjs / preact-compat

ATTENTION: The React compatibility layer for Preact has moved to the main preact repo.
http://npm.im/preact-compat
MIT License
950 stars 148 forks source link

[Material-UI] Select broken - modifying event target #535

Closed c-dante closed 4 years ago

c-dante commented 4 years ago

Looks like the material-ui/core/Select modifies the target on a native event.

Seems they're also doing it on item click: https://github.com/mui-org/material-ui/blob/cdc4b98b62b43d4e7253f731f2028e45d669acf5/packages/material-ui/src/Select/SelectInput.js#L129

Browsers throw an error since the event is marked read-only.

I noticed there is some work to use non-synthetic events in preact-compat -- is there a way to configure it in certain cases?

marvinhagemeister commented 4 years ago

Did you try with Preact X? preact-compat has moved into core and is available under the preact/compat import. It has much better compatibility than this library here, which is written for Preact 8.

c-dante commented 4 years ago

Yep! I can make the issue there -- didn't realize it was a separate repo.

Out build was using: "preact": "^10.0.0",

with the wp alias:

alias: {
    // preact-compat
    'react': 'preact/compat',
    "react-dom/test-utils": "preact/test-utils",
    'react-dom': 'preact/compat', // Must be below test-utils
    // Not necessary unless you consume a module using `createClass`
    'create-react-class': 'preact/compat/lib/create-react-class',
    // Not necessary unless you consume a module requiring `react-dom-factories`
    'react-dom-factories': 'preact/compat/lib/react-dom-factories',
},
c-dante commented 4 years ago

Closing this issue out -- the bugs are already reported in preact

marvinhagemeister commented 4 years ago

FYI: The create-react-class and react-dom-factories aliases are not needed anymore. They were only present in React <0.14.