Skip to content

Conversation

@JeanDamien
Copy link
Contributor

@JeanDamien JeanDamien commented Nov 21, 2025

TLDR
Properly detect which element is in fullscreen, to adjust the size of the workbench accordingly.

Context
Now that it's possible to synchronize the fullscreen state of the parent app down to the embedded workbench, the layout() method should check if the workbench is indeed in fullscreen before using the body size, so that it doesn't take the full size if the fullscreen element still has header/footer.

	layout(): void {
		if (!this.disposed) {
			const fullscreenElement = getFullscreenElement(mainWindow.document)
			this._mainContainerDimension = getClientArea(this.state.runtime.mainWindowFullscreen && this.mainContainer === fullscreenElement ?
				mainWindow.document.body : 	// in fullscreen mode, make sure to use <body> element because
				this.parent,				// in that case the workbench will span the entire site
				this.contextService.getWorkbenchState() === WorkbenchState.EMPTY ? DEFAULT_EMPTY_WINDOW_DIMENSIONS : DEFAULT_WORKSPACE_WINDOW_DIMENSIONS // running with fallback to ensure no error is thrown (https://github.com/microsoft/vscode/issues/240242)
			);
			this.logService.trace(`Layout#layout, height: ${this._mainContainerDimension.height}, width: ${this._mainContainerDimension.width}`);

			size(this.mainContainer, this._mainContainerDimension.width, this._mainContainerDimension.height);

			// Layout the grid widget
			this.workbenchGrid.layout(this._mainContainerDimension.width, this._mainContainerDimension.height);
			this.initialized = true;

			// Emit as event
			this.handleContainerDidLayout(this.mainContainer, this._mainContainerDimension);
		}
	}

@JeanDamien JeanDamien requested a review from CGNonofr November 21, 2025 18:07
Copy link
Contributor

@CGNonofr CGNonofr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JeanDamien JeanDamien marked this pull request as ready for review November 24, 2025 10:28
@JeanDamien JeanDamien merged commit 082827a into main Nov 24, 2025
2 checks passed
@JeanDamien JeanDamien deleted the jtx/fix-fullscreen-detection branch November 24, 2025 13:04
@github-actions
Copy link

🎉 This PR is included in version 23.1.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants