Repository navigation
feat(web): add a setting to skip floating previews on panel close #34256
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
base: main
Are you sure you want to change the base?
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 |
|---|---|---|
|
|
@@ -16,6 +16,7 @@ import { | |
| BROWSER_PROFILE_NAME_MAX_LENGTH, | ||
| BROWSER_RECORDING_FRAME_RATES, | ||
| DEFAULT_BROWSER_AUTO_SHOW_FLOATING_PREVIEW, | ||
| DEFAULT_BROWSER_FLOAT_PREVIEW_ON_PANEL_CLOSE, | ||
| DEFAULT_BROWSER_PROFILE_ID, | ||
| DEFAULT_BROWSER_LINK_TARGET, | ||
| DEFAULT_BROWSER_RECORDING_FRAME_RATE, | ||
|
|
@@ -1180,6 +1181,39 @@ function BrowserAutoShowFloatingPreviewSetting({ disabled }: { readonly disabled | |
| ); | ||
| } | ||
|
|
||
| function BrowserFloatPreviewOnPanelCloseSetting() { | ||
| const floatOnClose = useClientSettings((settings) => settings.browserFloatPreviewOnPanelClose); | ||
| const updateSettings = useUpdatePrimarySettings(); | ||
|
|
||
| return ( | ||
| <SettingsRow | ||
| {...searchableSetting("browser-float-preview-on-panel-close")} | ||
|
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. Initialize Opening Browser settings calls this undefined identifier and throws Add
|
||
| description="Keep a browser or device on screen as a floating preview when you close the right panel." | ||
| resetAction={ | ||
| floatOnClose !== DEFAULT_BROWSER_FLOAT_PREVIEW_ON_PANEL_CLOSE ? ( | ||
| <SettingResetButton | ||
| label="float preview on panel close" | ||
|
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. Pass
Replace
|
||
| onClick={() => | ||
| updateSettings({ | ||
| browserFloatPreviewOnPanelClose: DEFAULT_BROWSER_FLOAT_PREVIEW_ON_PANEL_CLOSE, | ||
| }) | ||
| } | ||
| /> | ||
| ) : null | ||
| } | ||
| control={ | ||
| <Switch | ||
| checked={floatOnClose} | ||
| onCheckedChange={(checked) => | ||
| updateSettings({ browserFloatPreviewOnPanelClose: Boolean(checked) }) | ||
| } | ||
| aria-label="Float preview on panel close" | ||
| /> | ||
| } | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| function BrowserProfilesSetting({ disabled }: { readonly disabled: boolean }) { | ||
| const searchableSetting = useSearchableSetting(); | ||
| const gt = useGT(); | ||
|
|
@@ -1702,6 +1736,8 @@ export function BrowserSettingsPanel() { | |
| <BrowserLinkTargetSetting disabled={desktopOnly} /> | ||
| <BrowserAutoShowFloatingPreviewSetting disabled={desktopOnly} /> | ||
| </SettingsUnavailableGroup> | ||
| {/* Not desktop-only: web clients float server-run browsers and devices too. */} | ||
| <BrowserFloatPreviewOnPanelCloseSetting /> | ||
| {/* Not desktop-only: web clients search from server-run browser tabs too. */} | ||
| <BrowserSearchEngineSetting /> | ||
| <AdvancedSettings | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -127,6 +127,7 @@ export type BrowserDefaultSettings = Pick< | |||||
| | "browserSearchEngine" | ||||||
| | "browserCustomSearchUrl" | ||||||
| | "browserAutoShowFloatingPreview" | ||||||
| | "browserFloatPreviewOnPanelClose" | ||||||
| | "pullRequestLinksOpenInApp" | ||||||
| >; | ||||||
|
|
||||||
|
|
@@ -175,6 +176,10 @@ export function getChangedBrowserSettingLabels( | |||||
| DEFAULT_UNIFIED_SETTINGS.browserAutoShowFloatingPreview | ||||||
| ? [resolve(msg("Floating preview"))] | ||||||
| : []), | ||||||
| ...(settings.browserFloatPreviewOnPanelClose !== | ||||||
| DEFAULT_UNIFIED_SETTINGS.browserFloatPreviewOnPanelClose | ||||||
| ? ["Float preview on panel close"] | ||||||
|
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. Resolve the new browser setting label like its sibling labels. The label Suggested fix
Committable suggestion
|
||||||
| : []), | ||||||
| ...(settings.pullRequestLinksOpenInApp !== DEFAULT_UNIFIED_SETTINGS.pullRequestLinksOpenInApp | ||||||
| ? [resolve(msg("Open pull requests in T3 Code"))] | ||||||
| : []), | ||||||
|
|
||||||
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.
Mark the float-on-close preference as a device preference.
The row writes the client-wide setting but does not pass
devicePreference. In project and checkout scopes, the switch therefore stays editable and changes the value for all projects. The neighboring browser preferences, including Auto-show floating preview, usedevicePreferenceto block this. Add the prop so the row shows the same read-only state in those scopes.Suggested fix
<SettingsRow {...searchableSetting("browser-float-preview-on-panel-close")} + devicePreference description="Keep a browser or device on screen as a floating preview when you close the right panel."