Repository navigation
fix(mobile): the iPad inspector hides the sidebar where the page would get too narrow #27218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,6 +58,9 @@ const AUXILIARY_PANE_MAX_WIDTH = 480; | |
| const AUXILIARY_PANE_DEFAULT_MAX_WIDTH = 320; | ||
| const FILE_INSPECTOR_MIN_VIEWPORT_WIDTH = 820; | ||
| const FILE_INSPECTOR_MIN_MAIN_WIDTH = 560; | ||
| // UIKit's inspector column keeps its own width, so the sidebar steps aside only when the page | ||
| // would get narrower than this: landscape 11" and 13" iPads keep three columns, portrait ones don't. | ||
| const NATIVE_INSPECTOR_MIN_MAIN_WIDTH = 320; | ||
|
|
||
| /** | ||
| * The window's width class. Compact: the sidebar is the root and pages push over it. Medium: the | ||
|
|
@@ -221,6 +224,8 @@ export function deriveWorkspacePaneLayout(input: { | |
| readonly primarySidebarPreferredVisible: boolean; | ||
| readonly auxiliaryPanePreferredVisible: boolean; | ||
| readonly auxiliaryPanePreferredWidth?: number; | ||
| /** The native inspector column's width; UIKit lays it out, not this layout. */ | ||
| readonly nativeInspectorWidth?: number; | ||
| }): WorkspacePaneLayout { | ||
| const viewportWidth = Math.max(0, input.viewportWidth); | ||
| const floats = input.primarySidebarFloats ?? input.layout.variant === "medium"; | ||
|
|
@@ -237,18 +242,17 @@ export function deriveWorkspacePaneLayout(input: { | |
| reservedLeadingWidth: preferredPrimarySidebarWidth, | ||
| }); | ||
| const auxiliaryPaneVisible = fileInspector.supported && input.auxiliaryPanePreferredVisible; | ||
| const inspectorWidth = input.nativeWorkspace | ||
| ? (input.nativeInspectorWidth ?? null) | ||
| : fileInspector.width; | ||
| const primarySidebarSuppressedByAuxiliary = | ||
| !input.nativeWorkspace && | ||
| preferredPrimarySidebarVisible && | ||
| !floats && | ||
| auxiliaryPaneVisible && | ||
| fileInspector.width !== null && | ||
| inspectorWidth !== null && | ||
| input.layout.listPaneWidth !== null && | ||
| viewportWidth - | ||
| input.layout.listPaneWidth - | ||
| (input.layout.listPaneGap ?? 0) - | ||
| fileInspector.width < | ||
| FILE_INSPECTOR_MIN_MAIN_WIDTH; | ||
| viewportWidth - input.layout.listPaneWidth - (input.layout.listPaneGap ?? 0) - inspectorWidth < | ||
| (input.nativeWorkspace ? NATIVE_INSPECTOR_MIN_MAIN_WIDTH : FILE_INSPECTOR_MIN_MAIN_WIDTH); | ||
|
Comment on lines
+254
to
+255
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hide the tab overlay when the inspector suppresses the sidebar. On a portrait 13-inch iPad, opening the inspector now hides the sidebar, but
|
||
| const primarySidebarVisible = | ||
| preferredPrimarySidebarVisible && !primarySidebarSuppressedByAuxiliary; | ||
| const primarySidebarWidth = primarySidebarVisible ? preferredPrimarySidebarWidth : 0; | ||
|
|
@@ -264,6 +268,10 @@ export function deriveWorkspacePaneLayout(input: { | |
| }; | ||
| } | ||
|
|
||
| export function nativeInspectorColumnWidth(viewportWidth: number, fraction: number) { | ||
| return Math.max(260, Math.min(viewportWidth * 0.6, viewportWidth * fraction)); | ||
| } | ||
|
|
||
| export function deriveFileInspectorPaneLayout(input: { | ||
| readonly layout: Layout; | ||
| readonly viewportWidth: number; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make the first sidebar request close the inspector.
If a user hides the sidebar before opening the inspector,
primarySidebarSuppressedByAuxiliaryis false. InAdaptiveWorkspaceLayout.tsx,togglePrimarySidebartherefore sets the sidebar preference to visible without closing the inspector. This calculation immediately suppresses the sidebar, so the first press does nothing. Update the toggle to account for the width conflict even when the sidebar preference is false. (raw.githubusercontent.com)