Summary
a11yTextExtractor in packages/core/src/a11y.ts references the global document without guarding for SSR:
const root = el.ownerDocument ?? document;
If el.ownerDocument is null and the function is called in a non-browser environment (e.g. during SSR testing, in a Node.js test harness, or in React Native), this throws ReferenceError: document is not defined.
Every other file in core that touches the DOM guards with typeof document !== 'undefined'. This one doesn't.
Fix
const root = el.ownerDocument ?? (typeof document !== 'undefined' ? document : null);
if (!root) return el.textContent?.trim() ?? '';
Impact
Any app that passes textExtractor: a11yTextExtractor and runs any code path (e.g. tests, SSR rendering) in a non-browser environment will crash.
Summary
a11yTextExtractorinpackages/core/src/a11y.tsreferences the globaldocumentwithout guarding for SSR:If
el.ownerDocumentis null and the function is called in a non-browser environment (e.g. during SSR testing, in a Node.js test harness, or in React Native), this throwsReferenceError: document is not defined.Every other file in core that touches the DOM guards with
typeof document !== 'undefined'. This one doesn't.Fix
Impact
Any app that passes
textExtractor: a11yTextExtractorand runs any code path (e.g. tests, SSR rendering) in a non-browser environment will crash.