We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a64bdd2 commit ddef5c7Copy full SHA for ddef5c7
packages/@headlessui-react/src/internal/floating.tsx
@@ -134,10 +134,12 @@ export function useFloatingPanel(
134
() => placement,
135
[
136
JSON.stringify(placement, (_, v) => {
137
- if (typeof v === 'object' && v !== null && 'outerHTML' in v) {
138
- return v.outerHTML
139
- }
140
- return v
+ // When we are trying to stringify a DOM element, we want to return the
+ // `outerHTML` of the element. In all other cases, we want to return the
+ // value as-is.
+ // It's not safe enough to check whether `v` is an instanceof
141
+ // `HTMLElement` because some tools (like AG Grid) polyfill it to be `{}`.
142
+ return v?.outerHTML ?? v
143
}),
144
]
145
)
0 commit comments