|
998 | 998 | let hasActuallyMoved;
|
999 | 999 | for (const draggedTab of movingTabs) {
|
1000 | 1000 | let isRegularTabs = false;
|
| 1001 | + // Check for essentials container |
| 1002 | + if (essentialTabsTarget) { |
| 1003 | + if (!draggedTab.hasAttribute('zen-essential') && !draggedTab?.group) { |
| 1004 | + moved = true; |
| 1005 | + isVertical = false; |
| 1006 | + hasActuallyMoved = this.addToEssentials(draggedTab); |
| 1007 | + } |
| 1008 | + } |
1001 | 1009 | // Check for pinned tabs container
|
1002 |
| - if (pinnedTabsTarget) { |
| 1010 | + else if (pinnedTabsTarget) { |
1003 | 1011 | if (!draggedTab.pinned) {
|
1004 | 1012 | gBrowser.pinTab(draggedTab);
|
1005 |
| - moved = true; |
1006 | 1013 | } else if (draggedTab.hasAttribute('zen-essential')) {
|
1007 | 1014 | this.removeEssentials(draggedTab, false);
|
1008 | 1015 | moved = true;
|
1009 | 1016 | }
|
1010 | 1017 | }
|
1011 |
| - // Check for essentials container |
1012 |
| - else if (essentialTabsTarget) { |
1013 |
| - if (!draggedTab.hasAttribute('zen-essential') && !draggedTab?.group) { |
1014 |
| - moved = true; |
1015 |
| - isVertical = false; |
1016 |
| - hasActuallyMoved = this.addToEssentials(draggedTab); |
1017 |
| - } |
1018 |
| - } |
1019 | 1018 | // Check for normal tabs container
|
1020 | 1019 | else if (tabsTarget || event.target.id === 'zen-tabs-wrapper') {
|
1021 |
| - if ( |
1022 |
| - draggedTab.pinned && |
1023 |
| - !draggedTab.hasAttribute('zen-essential') && |
1024 |
| - !draggedTab?.group?.isZenFolder |
1025 |
| - ) { |
| 1020 | + if (draggedTab.pinned && !draggedTab.hasAttribute('zen-essential')) { |
1026 | 1021 | gBrowser.unpinTab(draggedTab);
|
1027 |
| - moved = true; |
1028 | 1022 | isRegularTabs = true;
|
1029 | 1023 | } else if (draggedTab.hasAttribute('zen-essential')) {
|
1030 | 1024 | this.removeEssentials(draggedTab);
|
|
1139 | 1133 | for (const item of this.dragShiftableItems) {
|
1140 | 1134 | item.style.transform = '';
|
1141 | 1135 | }
|
| 1136 | + for (const item of gBrowser.tabContainer.ariaFocusableItems) { |
| 1137 | + if (gBrowser.isTab(item)) { |
| 1138 | + let isVisible = true; |
| 1139 | + let parent = item.group; |
| 1140 | + while (parent) { |
| 1141 | + if (parent.collapsed && !parent.hasAttribute('has-active')) { |
| 1142 | + isVisible = false; |
| 1143 | + break; |
| 1144 | + } |
| 1145 | + parent = parent.group; |
| 1146 | + } |
| 1147 | + if (!isVisible) { |
| 1148 | + continue; |
| 1149 | + } |
| 1150 | + } |
| 1151 | + item.style.removeProperty('--zen-folder-indent'); |
| 1152 | + } |
1142 | 1153 | this.removeTabContainersDragoverClass();
|
1143 | 1154 | }
|
1144 | 1155 |
|
|
1157 | 1168 | draggedTab = draggedTab.group;
|
1158 | 1169 | }
|
1159 | 1170 | const itemsToCheck = this.dragShiftableItems;
|
1160 |
| - const separator = itemsToCheck[0]; |
1161 |
| - const separatorRect = window.windowUtils.getBoundsWithoutFlushing(separator); |
| 1171 | + const separatorHeight = window.windowUtils.getBoundsWithoutFlushing(itemsToCheck[0]).height; |
1162 | 1172 | const tabRect = window.windowUtils.getBoundsWithoutFlushing(draggedTab);
|
1163 |
| - const translate = tabRect.top - tabRect.height / 2 + separatorRect.height / 2; |
1164 |
| - const topToNormalTabs = separatorRect.top - separatorRect.height / 2; |
| 1173 | + const translate = tabRect.top - tabRect.height / 2; |
| 1174 | + const topToNormalTabs = |
| 1175 | + window.windowUtils.getBoundsWithoutFlushing(itemsToCheck[0]).top - separatorHeight / 2; |
1165 | 1176 | const isGoingToPinnedTabs = translate < topToNormalTabs;
|
1166 | 1177 | const multiplier = isGoingToPinnedTabs !== isPinned ? (isGoingToPinnedTabs ? 1 : -1) : 0;
|
1167 | 1178 | const draggingTabHeight =
|
|
1253 | 1264 | if (!this.enabled) {
|
1254 | 1265 | return;
|
1255 | 1266 | }
|
1256 |
| - const folderTarget = event.target.closest('zen-folder'); |
1257 | 1267 | let isVertical = this.expandedSidebarMode;
|
1258 |
| - //if (isVertical) { |
1259 |
| - // draggedTab.style.marginInlineStart = `${gZenFolders.getFolderIndentation(draggedTab, folderTarget)}px`; |
1260 |
| - //} |
1261 |
| - |
1262 | 1268 | if (
|
1263 | 1269 | gBrowser.isTabGroupLabel(draggedTab) &&
|
1264 | 1270 | !draggedTab?.group?.hasAttribute('split-view-group')
|
|
1270 | 1276 | const pinnedTabsTarget = event.target.closest('.zen-workspace-pinned-tabs-section');
|
1271 | 1277 | const essentialTabsTarget = event.target.closest('.zen-essentials-container');
|
1272 | 1278 | const tabsTarget = event.target.closest('.zen-workspace-normal-tabs-section');
|
| 1279 | + const folderTarget = event.target.closest('zen-folder'); |
1273 | 1280 | let targetTab = event.target.closest('.tabbrowser-tab');
|
1274 | 1281 | targetTab = targetTab?.group || targetTab;
|
1275 | 1282 | draggedTab = draggedTab?.group?.hasAttribute('split-view-group')
|
|
1290 | 1297 | let shouldAddDragOverElement = false;
|
1291 | 1298 |
|
1292 | 1299 | // Decide whether we should show a dragover class for the given target
|
1293 |
| - if (pinnedTabsTarget) { |
1294 |
| - if (draggedTab.hasAttribute('zen-essential')) { |
1295 |
| - shouldAddDragOverElement = true; |
1296 |
| - } |
1297 |
| - } else if (essentialTabsTarget) { |
| 1300 | + if (essentialTabsTarget) { |
1298 | 1301 | if (!draggedTab.hasAttribute('zen-essential') && this.canEssentialBeAdded(draggedTab)) {
|
1299 | 1302 | shouldAddDragOverElement = true;
|
1300 | 1303 | isVertical = false;
|
1301 | 1304 | }
|
| 1305 | + } else if (pinnedTabsTarget) { |
| 1306 | + if (draggedTab.hasAttribute('zen-essential')) { |
| 1307 | + shouldAddDragOverElement = true; |
| 1308 | + } |
1302 | 1309 | } else if (tabsTarget) {
|
1303 | 1310 | if (draggedTab.hasAttribute('zen-essential')) {
|
1304 | 1311 | shouldAddDragOverElement = true;
|
|
0 commit comments