preactjs / preact

⚛️ Fast 3kB React alternative with the same modern API. Components & Virtual DOM.
https://preactjs.com
MIT License
36.87k stars 1.95k forks source link

Material UI 4.0.0 PopOver and Selects not working. lastFocus.current is null #1993

Open pinkfloydsito opened 5 years ago

pinkfloydsito commented 5 years ago

"Material UI": 4.0.0, "preact": "^10.0.0", "preact-compat": "^3.19.0", "react": "^16.8.5"

Currently whenever I use the Popover from material UI or its selects trapfocus throws an exception when the modal is closed. Is there any workaround for this?

TypeError: "lastFocus.current is null"
    TrapFocus TrapFocus.js:98
    Preact 13
    safeSetState Transition.js:318
    performExit Transition.js:297
    nextCallback Transition.js:330
    setTimeout handler*addEndListener Grow.js:116
    onTransitionEnd Transition.js:351
    performExit Transition.js:296
    nextCallback Transition.js:330
    Preact 5
    update SelectInput.js:114
    handleItemClick SelectInput.js:131
    Preact 31
index.js:1446
    e index.js:1446
    componentDidCatch ErrorBoundary.js:10
    Preact 9
    safeSetState Transition.js:318
    performExit Transition.js:297
    nextCallback Transition.js:330
    addEndListener Grow.js:116
    onTransitionEnd Transition.js:351
    performExit Transition.js:296
    nextCallback Transition.js:330
    Preact 5
    update SelectInput.js:114
    handleItemClick SelectInput.js:131
    Preact 31

image After I lose focus from the Select the exception is thrown.

JoviDeCroock commented 5 years ago

Hey,

Are you using that preact-compat dependency? You should be reffing to preact/compat now. I'll look into how that component works and report back.

pinkfloydsito commented 5 years ago

Yes, I am using it.

image