Skip to content

Commit

Permalink
Fix inverted drop position marker for faviconized tabs on RTL environ…
Browse files Browse the repository at this point in the history
…ment #3689
  • Loading branch information
piroor committed Jan 6, 2025
1 parent 5e1cab5 commit f232d89
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions webextensions/sidebar/drag-and-drop.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ function getDropAction(event) {
const onFaviconizedTab = targetTab.pinned && configs.faviconizePinnedTabs;
const dropAreasCount = (info.draggedTab && onFaviconizedTab && !info.substanceTargetTab) ? 2 : 3 ;
const targetTabRect = Scroll.getTabRect(targetTab);
const targetTabCoordinate = onFaviconizedTab ? (isRTL() ? targetTabRect.right : targetTabRect.left) : targetTabRect.top ;
const targetTabCoordinate = onFaviconizedTab ? targetTabRect.left : targetTabRect.top ;
const targetTabSize = onFaviconizedTab ? targetTabRect.width : targetTabRect.height ;
let beforeOrAfterDropAreaSize;
if (dropAreasCount == 2) {
Expand All @@ -369,13 +369,14 @@ function getDropAction(event) {
after: `> ${targetTabCoordinate + targetTabSize - beforeOrAfterDropAreaSize}`,
});
*/
const shouldInvertArea = onFaviconizedTab && isRTL();
if (eventCoordinate < targetTabCoordinate + beforeOrAfterDropAreaSize) {
info.dropPosition = kDROP_BEFORE;
info.dropPosition = shouldInvertArea ? kDROP_AFTER : kDROP_BEFORE;
info.insertBefore = info.firstTargetTab;
}
else if (dropAreasCount == 2 ||
eventCoordinate > targetTabCoordinate + targetTabSize - beforeOrAfterDropAreaSize) {
info.dropPosition = kDROP_AFTER;
info.dropPosition = shouldInvertArea ? kDROP_BEFORE : kDROP_AFTER;
info.insertAfter = info.lastTargetTab;
}
else {
Expand Down
6 changes: 4 additions & 2 deletions webextensions/sidebar/styles/drag-and-drop.css
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,15 @@ tab-item:not(.faviconized)[data-drop-position="after"] tab-item-substance::befor
right: 0;
}

tab-item.faviconized[data-drop-position="before"] tab-item-substance::before {
:root:not(.rtl) tab-item.faviconized[data-drop-position="before"] tab-item-substance::before,
:root.rtl tab-item.faviconized[data-drop-position="after"] tab-item-substance::before {
bottom: 0;
left: 0;
top: 0;
}

tab-item.faviconized[data-drop-position="after"] tab-item-substance::before {
:root:not(.rtl) tab-item.faviconized[data-drop-position="after"] tab-item-substance::before,
:root.rtl tab-item.faviconized[data-drop-position="before"] tab-item-substance::before {
bottom: 0;
right: 0;
top: 0;
Expand Down

0 comments on commit f232d89

Please sign in to comment.