Skip to content

Commit ff253d7

Browse files
committed
fix(panel): tools tab non-draggable and always shows icon+text
- Make the default panel (Tools) tab non-draggable: set draggable="false" on the tab, reject dragstart on it, and reject it as a drop target - Add bottom-panel-tab-default class to identify the Tools tab in CSS - Always show the icon alongside the title for the Tools tab in both expanded and collapsed modes (other tabs show icons only when collapsed) - In collapsed mode, the Tools tab keeps its natural width with title visible instead of collapsing to a fixed icon-only width
1 parent fe9a6ad commit ff253d7

2 files changed

Lines changed: 39 additions & 3 deletions

File tree

src/styles/Extn-BottomPanelTabs.less

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,13 @@
166166
display: none;
167167
}
168168

169+
/* Default panel (Tools) tab: always show the icon alongside the title,
170+
in both expanded and collapsed modes, active or inactive. */
171+
.bottom-panel-tab.bottom-panel-tab-default .bottom-panel-tab-icon {
172+
display: inline-flex;
173+
margin-right: 0.4rem;
174+
}
175+
169176
.default-panel-btn .panel-titlebar-icon {
170177
width: 20px;
171178
height: 20px;
@@ -240,6 +247,15 @@
240247
.bottom-panel-tab:not(.active) .bottom-panel-tab-close-btn {
241248
display: none;
242249
}
250+
/* Default panel (Tools) tab: keep natural width and show its title
251+
even in collapsed mode (other tabs collapse to icon-only). */
252+
.bottom-panel-tab.bottom-panel-tab-default {
253+
min-width: auto;
254+
justify-content: flex-start;
255+
}
256+
.bottom-panel-tab.bottom-panel-tab-default .bottom-panel-tab-title {
257+
display: inline;
258+
}
243259
}
244260

245261
.bottom-panel-tab-close-btn {
@@ -301,8 +317,15 @@
301317
font-size: 0.82rem;
302318
flex: 0 0 auto;
303319
white-space: nowrap;
320+
user-select: none;
321+
-webkit-user-drag: none;
304322
transition: color 0.12s ease, background-color 0.12s ease;
305323

324+
img {
325+
-webkit-user-drag: none;
326+
pointer-events: none;
327+
}
328+
306329
.dark & {
307330
color: #777;
308331
}

src/view/PanelView.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,11 @@ define(function (require, exports, module) {
149149
*/
150150
function _buildTab(panel, isActive) {
151151
let title = panel._tabTitle || _getPanelTitle(panel.panelID, panel.$panel);
152-
let $tab = $('<div class="bottom-panel-tab" draggable="true"></div>')
152+
// Default panel (Tools) tab is not draggable — it's a fixed slot, not a user tab
153+
const isDefault = panel.panelID === _defaultPanelId;
154+
let $tab = $('<div class="bottom-panel-tab"></div>')
155+
.toggleClass('bottom-panel-tab-default', isDefault)
156+
.attr('draggable', isDefault ? 'false' : 'true')
153157
.toggleClass('active', isActive)
154158
.attr('data-panel-id', panel.panelID);
155159
const iconSrc = panel._options.iconSvg || "styles/images/panel-icon-default.svg";
@@ -288,6 +292,11 @@ define(function (require, exports, module) {
288292
}
289293

290294
_$tabBar.on("dragstart", ".bottom-panel-tab", function (e) {
295+
// Default panel (Tools) tab is never draggable
296+
if ($(this).data("panel-id") === _defaultPanelId) {
297+
e.preventDefault();
298+
return;
299+
}
291300
draggedTab = this;
292301
e.originalEvent.dataTransfer.effectAllowed = "move";
293302
e.originalEvent.dataTransfer.setData("application/x-phoenix-panel-tab", "1");
@@ -302,6 +311,10 @@ define(function (require, exports, module) {
302311
if (!draggedTab || this === draggedTab) {
303312
return;
304313
}
314+
// Don't allow dropping onto the default panel (Tools) tab
315+
if ($(this).data("panel-id") === _defaultPanelId) {
316+
return;
317+
}
305318
e.preventDefault();
306319
e.originalEvent.dataTransfer.dropEffect = "move";
307320
_$tabBar.find(".bottom-panel-tab").removeClass("drag-target");
@@ -766,8 +779,8 @@ define(function (require, exports, module) {
766779
_defaultPanelId = defaultPanelId;
767780

768781
// Create the "Tools" button inside the scrollable tabs area.
769-
_$addBtn = $('<span class="bottom-panel-add-btn" title="' + Strings.BOTTOM_PANEL_DEFAULT_TITLE + '">'
770-
+ '<img class="app-drawer-tab-icon" src="styles/images/app-drawer.svg"'
782+
_$addBtn = $('<span class="bottom-panel-add-btn" draggable="false" title="' + Strings.BOTTOM_PANEL_DEFAULT_TITLE + '">'
783+
+ '<img class="app-drawer-tab-icon" draggable="false" src="styles/images/app-drawer.svg"'
771784
+ ' style="width:12px;height:12px;vertical-align:middle;margin-right:4px">'
772785
+ Strings.BOTTOM_PANEL_DEFAULT_TITLE + '</span>');
773786
_$tabsOverflow.append(_$addBtn);

0 commit comments

Comments
 (0)