primereact icon indicating copy to clipboard operation
primereact copied to clipboard

EDIT: Works again in 9.2.1 - attribute appendTo ShadowDom for the <Dropdown /> does not work anymore for 9.2.0 (crashes)

Open rogiermulders opened this issue 3 years ago • 1 comments

Describe the bug

When attaching the Dropdown like so <Dropdown appendTo={shadowRoot}/> and selecting the dropdown it crashes primereact (when selecting the dropdown).

I'm sorry i can not include the primereact CSS in codesanbox ShadowDom. I don't know how to do that with codesandbox (Webpack handles that)

PS It works on 8.7.3 and crashes in 9.2.0

Locally I can fix it by adding this line to utils/utils.esm.js line 643: var styleDeclaration = node && node.constructor.name !== 'ShadowRoot' ? getComputedStyle(node) : null;

I found it here in the repo: primereact/components/lib/utils/DomHandler.js line 522: Replace: let styleDeclaration = node ? getComputedStyle(node) : null; With the line below might do the trick: let styleDeclaration = node && node.constructor.name !== 'ShadowRoot' ? getComputedStyle(node) : null;

Not interested in any styleDeclaration when the ShadowRoot is given as the node so might be safe?

PS I don't think it is exactly the same as my other issue: https://github.com/primefaces/primereact/issues/4143 this because my dirty fix does not fix the tooltip issue

Reproducer

https://codesandbox.io/s/sgcncg

PrimeReact version

9.2.0

React version

18.x

Language

ES6

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

Go to codesandbox and click 'Select a City'

Expected behavior

Not crashing

rogiermulders avatar Mar 13 '23 11:03 rogiermulders

Works again in 9.2.1

rogiermulders avatar Mar 17 '23 17:03 rogiermulders