Skip to content

Commit d7c36dc

Browse files
authored
fix(query-devtools): Fix PiP mode styles with shadow dom (#7112)
1 parent d07fc32 commit d7c36dc

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

examples/react/shadow-dom/src/DogList.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const DogList = () => {
2727
return (
2828
<div>
2929
{dogs.map((dog) => (
30-
<div>{dog}</div>
30+
<div key={dog}>{dog}</div>
3131
))}
3232
</div>
3333
)

packages/query-devtools/src/Devtools.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ const PiPProvider = (props: PiPProviderProps) => {
182182

183183
// It is important to copy all parent window styles. Otherwise, there would be no CSS available at all
184184
// https://developer.chrome.com/docs/web-platform/document-picture-in-picture/#copy-style-sheets-to-the-picture-in-picture-window
185-
;[...document.styleSheets].forEach((styleSheet) => {
185+
;[
186+
...(useQueryDevtoolsContext().shadowDOMTarget || document).styleSheets,
187+
].forEach((styleSheet) => {
186188
try {
187189
const cssRules = [...styleSheet.cssRules]
188190
.map((rule) => rule.cssText)

0 commit comments

Comments
 (0)