From 3f3f6abfb90ebd0367e0e894e16aa48fd6c62a39 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Sun, 31 May 2026 20:33:19 -0700 Subject: [PATCH] fix(browser): parenthesize document fallback for CoreBrowserService Nullish coalescing binds tighter than the conditional operator, so the previous expression was parsed as (this._document ?? windowDefined) ? window.document : null. When this._document was set (e.g. parent ownerDocument or documentOverride), the ternary still returned window.document instead of the configured document. CoreBrowserService.mainDocument is used by AccessibilityManager, viewport styles, and decoration renderers; CharSizeService already received this._document directly. Add parentheses so the fallback applies only when _document is nullish. Co-authored-by: Cursor --- src/browser/CoreBrowserTerminal.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browser/CoreBrowserTerminal.ts b/src/browser/CoreBrowserTerminal.ts index f7e20b914..5b65a93db 100644 --- a/src/browser/CoreBrowserTerminal.ts +++ b/src/browser/CoreBrowserTerminal.ts @@ -505,7 +505,7 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal { this.textarea, parent.ownerDocument.defaultView ?? window, // Force unsafe null in node.js environment for tests - this._document ?? (typeof window !== 'undefined') ? window.document : null as any + this._document ?? ((typeof window !== 'undefined') ? window.document : null as any) )); this._instantiationService.setService(ICoreBrowserService, this._coreBrowserService);