Skip to content

Commit cfc03c3

Browse files
committed
[devtools] fullscreen mode should not be draggable
1 parent 65fb743 commit cfc03c3

File tree

3 files changed

+31
-21
lines changed

3 files changed

+31
-21
lines changed

packages/next/src/next-devtools/dev-overlay/components/devtools-panel/devtools-panel-footer.tsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,19 @@ import { css } from '../../utils/css'
77

88
export function DevToolsPanelFooter({
99
versionInfo,
10+
isDraggable,
1011
}: {
1112
versionInfo: OverlayState['versionInfo']
13+
isDraggable: boolean
1214
}) {
1315
const bundlerName = (
1416
process.env.__NEXT_BUNDLER || 'WEBPACK'
1517
).toUpperCase() as 'WEBPACK' | 'TURBOPACK' | 'RSPACK'
1618
return (
17-
<div data-nextjs-devtools-panel-footer>
19+
<div
20+
data-nextjs-devtools-panel-footer
21+
data-nextjs-devtools-panel-draggable={isDraggable}
22+
>
1823
<div data-nextjs-devtools-panel-footer-tab-group>
1924
<DevToolsPanelVersionInfo versionInfo={versionInfo} />
2025
<div data-nextjs-devtools-panel-footer-tab>
@@ -51,15 +56,6 @@ export const DEVTOOLS_PANEL_FOOTER_STYLES = css`
5156
align-items: center;
5257
border-top: 1px solid var(--color-gray-400);
5358
border-radius: 0 0 var(--rounded-xl) var(--rounded-xl);
54-
55-
/* For draggable */
56-
cursor: move;
57-
user-select: none;
58-
& > * {
59-
cursor: auto;
60-
/* user-select: auto; follows the parent (parent none -> child none), so reset the direct child to text */
61-
user-select: text;
62-
}
6359
}
6460
6561
[data-nextjs-devtools-panel-footer-tab-group] {

packages/next/src/next-devtools/dev-overlay/components/devtools-panel/devtools-panel.tsx

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ export function DevToolsPanel({
9898
})
9999
}}
100100
dragHandleSelector="[data-nextjs-devtools-panel-header], [data-nextjs-devtools-panel-footer]"
101+
disableDrag={isFullscreen}
101102
>
102103
<>
103104
<Dialog
@@ -108,7 +109,10 @@ export function DevToolsPanel({
108109
>
109110
<DialogContent data-nextjs-devtools-panel-dialog-content>
110111
<DialogHeader data-nextjs-devtools-panel-dialog-header>
111-
<div data-nextjs-devtools-panel-header>
112+
<div
113+
data-nextjs-devtools-panel-header
114+
data-nextjs-devtools-panel-draggable={!isFullscreen}
115+
>
112116
<div data-nextjs-devtools-panel-header-tab-group>
113117
<button
114118
data-nextjs-devtools-panel-header-tab={
@@ -175,7 +179,10 @@ export function DevToolsPanel({
175179
/>
176180
</DialogBody>
177181
</DialogContent>
178-
<DevToolsPanelFooter versionInfo={state.versionInfo} />
182+
<DevToolsPanelFooter
183+
versionInfo={state.versionInfo}
184+
isDraggable={!isFullscreen}
185+
/>
179186
</Dialog>
180187
</>
181188
</Draggable>
@@ -261,15 +268,6 @@ export const DEVTOOLS_PANEL_STYLES = css`
261268
justify-content: space-between;
262269
align-items: center;
263270
border-bottom: 1px solid var(--color-gray-400);
264-
265-
/* For draggable */
266-
cursor: move;
267-
user-select: none;
268-
& > * {
269-
cursor: auto;
270-
/* user-select: auto; follows the parent (parent none -> child none), so reset the direct child to text */
271-
user-select: text;
272-
}
273271
}
274272
275273
[data-nextjs-devtools-panel-header-tab-group] {
@@ -345,4 +343,14 @@ export const DEVTOOLS_PANEL_STYLES = css`
345343
background-color: var(--color-gray-300);
346344
}
347345
}
346+
347+
[data-nextjs-devtools-panel-draggable='true'] {
348+
cursor: move;
349+
user-select: none;
350+
& > * {
351+
cursor: auto;
352+
/* user-select: auto; follows the parent (parent none -> child none), so reset the direct child to text */
353+
user-select: text;
354+
}
355+
}
348356
`

packages/next/src/next-devtools/dev-overlay/components/errors/dev-tools-indicator/draggable.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export function Draggable({
1818
setPosition: setCurrentCorner,
1919
onDragStart,
2020
dragHandleSelector,
21+
disableDrag,
2122
...props
2223
}: {
2324
children: React.ReactElement
@@ -26,6 +27,7 @@ export function Draggable({
2627
setPosition: (position: Corners) => void
2728
onDragStart?: () => void
2829
dragHandleSelector?: string
30+
disableDrag?: boolean
2931
}) {
3032
const { ref, animate, ...drag } = useDrag({
3133
threshold: 5,
@@ -35,6 +37,10 @@ export function Draggable({
3537
dragHandleSelector,
3638
})
3739

40+
if (disableDrag) {
41+
return children
42+
}
43+
3844
function onDragEnd(translation: Point, velocity: Point) {
3945
const projectedPosition = {
4046
x: translation.x + project(velocity.x),

0 commit comments

Comments
 (0)