Close mobile sidebar drawer when creating a new session#314572
Merged
Conversation
On the agents mobile web layout, tapping the (+) buttons to create a new session left the sidebar drawer covering the viewport, hiding the new session view. Now the drawer is dismissed automatically: - The (+) button in the mobile titlebar (workbench.ts). - The per-workspace section (+) button inside the sessions list (NewSessionForWorkspaceAction). Both call sites are gated on `isWeb && isMobile` to match the existing `onSessionOpen` pattern in sessionsView.ts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Screenshot ChangesBase: Changed (12) |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR targets the Agents (sessions) window phone-layout UX by ensuring the sidebar overlay drawer doesn’t keep covering the viewport after the user creates a new session via “+” actions.
Changes:
- Mobile titlebar “+” now attempts to close the sidebar drawer after creating a new session.
- Sessions view per-workspace “+” action now hides the sidebar after creating a new session and selecting the workspace.
Show a summary per file
| File | Description |
|---|---|
| src/vs/sessions/contrib/sessions/browser/views/sessionsViewActions.ts | Hides the sidebar after “New Session” is invoked from a workspace section, to reveal the newly created session view. |
| src/vs/sessions/browser/workbench.ts | Closes the mobile sidebar drawer when the topbar “New Session” action is triggered. |
Copilot's findings
Comments suppressed due to low confidence (1)
src/vs/sessions/contrib/sessions/browser/views/sessionsViewActions.ts:360
- The condition
if (isWeb && isMobile)is based on device detection, but the overlay sidebar is controlled by sessions phone layout (viewport width). In a narrow desktop web viewport that triggers phone layout, this will not close the overlay drawer and the new session view can remain hidden. Consider checkingIsPhoneLayoutContext(sessions context key) instead ofisMobileso this matches the actual layout state.
// On mobile web, the sidebar drawer covers the viewport; close it so
// the new session view becomes visible after creation.
if (isWeb && isMobile) {
layoutService.setPartHidden(true, Parts.SIDEBAR_PART);
- Files reviewed: 2/2 changed files
- Comments generated: 2
Closed
roblourens
approved these changes
May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On the agents mobile web layout, tapping the (+) buttons to create a new session left the sidebar drawer covering the viewport, so the new session view stayed hidden behind it. Now the drawer dismisses automatically once a new session is created.
Changes
src/vs/sessions/browser/workbench.ts— after the mobile titlebar's(+)button callsopenNewSessionView(), also callcloseMobileSidebarDrawer().src/vs/sessions/contrib/sessions/browser/views/sessionsViewActions.ts—NewSessionForWorkspaceAction(the per-workspace section(+)button rendered inside the sessions list) hides the sidebar viaIWorkbenchLayoutService.setPartHidden(true, Parts.SIDEBAR_PART).Both call sites are gated on
isWeb && isMobileso the change is a no-op on desktop and on native, matching the existingonSessionOpenpattern insessionsView.tsthat already closes the drawer when an existing session is opened.Validation
npm run compile-check-ts-native✅npx eslinton both files ✅