Skip to content

Commit

Permalink
Fix: Menu - RTL support #387
Browse files Browse the repository at this point in the history
  • Loading branch information
black7375 committed Sep 5, 2022
1 parent b435705 commit 734ed69
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 25 deletions.
15 changes: 10 additions & 5 deletions css/leptonChrome.css
Original file line number Diff line number Diff line change
Expand Up @@ -9106,9 +9106,13 @@

/* Padding */
:root {
--uc-menu-background-position: left;
--context-menu-background-padding-default: 5px;
--context-menu-background-padding: var(--context-menu-background-padding-default);
}
:root:-moz-locale-dir(rtl) {
--uc-menu-background-position: right;
}

:not(menu, #ContentSelectDropdown, #context-navigation) > menupopup > menuitem:not(.menuitem-iconic),
:not(menu, #ContentSelectDropdown, #context-navigation) > menupopup > menu:not(.menu-iconic),
Expand All @@ -9130,19 +9134,20 @@
.openintabs-menuitem,
#blockedPopupDontShowMessage,
#BMB_viewBookmarksToolbar {
background-position: left var(--context-menu-background-padding) center !important;
background-position: var(--uc-menu-background-position) var(--context-menu-background-padding) center !important;
padding-inline-start: var(--context-menu-background-padding) !important;
}

/* Menubar */
@supports -moz-bool-pref("userChrome.icon.global_menubar") {
#main-menubar > menu {
background-position: left var(--context-menu-background-padding-default) center !important;
background-position: var(--uc-menu-background-position) var(--context-menu-background-padding-default) center !important;
padding-inline-start: calc(16px + var(--context-menu-background-padding-default)) !important;
padding-inline-end: 3px;
}
#main-menubar > menu:first-child {
background-position: left calc(3px + var(--context-menu-background-padding-default)) center !important;
background-position: var(--uc-menu-background-position) calc(3px + var(--context-menu-background-padding-default))
center !important;
padding-inline-start: calc(19px + var(--context-menu-background-padding-default)) !important;
}
#main-menubar > menu > menupopup {
Expand Down Expand Up @@ -9311,7 +9316,7 @@
#PersonalToolbar menupopup[placespopup="true"] menuitem:not(.menuitem-iconic, [disabled="true"]),
#PersonalToolbar menupopup[placespopup="true"] menu:not(.menu-iconic) {
margin-inline: var(--arrowpanel-menuitem-padding-inline) !important;
background-position: left calc(var(--arrowpanel-menuicon-padding)) center !important;
background-position: var(--uc-menu-background-position) calc(var(--arrowpanel-menuicon-padding)) center !important;
}

menupopup:is(#BMB_bookmarksPopup) menuitem:not(.menuitem-iconic, [disabled="true"]),
Expand All @@ -9335,7 +9340,7 @@
#PersonalToolbar menupopup[placespopup="true"] menu:not(.menu-iconic) {
margin-inline: var(--arrowpanel-menuitem-padding-inline) !important;
padding-inline-start: calc(var(--arrowpanel-menuicon-padding) + var(--context-menu-text-padding)) !important;
background-position: left calc(var(--arrowpanel-menuicon-padding)) center !important;
background-position: var(--uc-menu-background-position) calc(var(--arrowpanel-menuicon-padding)) center !important;
}
}
/* Linux */
Expand Down
20 changes: 14 additions & 6 deletions css/leptonContent.css
Original file line number Diff line number Diff line change
Expand Up @@ -279,15 +279,19 @@
}

.context-menu-list .context-menu-item button span {
padding-inline-start: 24px;
/* 16p + (4px * 2) */
/* Color */
-moz-context-properties: fill, fill-opacity !important;
fill: currentColor !important;
/* Layout */
background-size: 16px;
background-repeat: no-repeat;
background-size: 16px !important;
background-repeat: no-repeat !important;
background-image: var(--menuitem-image);
background-position: left 4px center;
padding-inline-start: 24px;
/* 16p + (4px * 2) */
background-position: var(--uc-menu-background-position, left) 4px center;
}
.context-menu-list .context-menu-item button span:dir(rtl) {
--uc-menu-background-position: right;
}

.context-menu-item span[data-l10n-id="newtab-menu-pin"] {
Expand Down Expand Up @@ -3037,9 +3041,13 @@

/* Padding */
:root {
--uc-menu-background-position: left;
--context-menu-background-padding-default: 5px;
--context-menu-background-padding: var(--context-menu-background-padding-default);
}
:root:-moz-locale-dir(rtl) {
--uc-menu-background-position: right;
}

menupopup:is(#placesContext, #placesColumnsContext, #downloadsContextMenu)
menuitem:not(.menuitem-iconic, .bookmark-item, .in-menulist, [checked="true"]),
Expand All @@ -3048,7 +3056,7 @@
menupopup:is(#organizeButtonPopup, #maintenanceButtonPopup)
> menuitem:not(.menuitem-iconic, .bookmark-item, .in-menulist, [checked="true"]),
menupopup:is(#viewMenuPopup, #maintenanceButtonPopup) > menu:not(.menu-iconic, .in-menulist, [checked="true"]) {
background-position: left var(--context-menu-background-padding) center !important;
background-position: var(--uc-menu-background-position) var(--context-menu-background-padding) center !important;
padding-inline-start: var(--context-menu-background-padding) !important;
}

Expand Down
17 changes: 8 additions & 9 deletions src/icons/layout/_activity_stream.scss
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
@import "./menu_common";

.context-menu-list .context-menu-item button {
padding-inline-start: 0 !important;
}

.context-menu-list .context-menu-item button span {
padding-inline-start: 24px; /* 16p + (4px * 2) */
@include _layout_icon_menus;

-moz-context-properties: fill, fill-opacity !important;
fill: currentColor !important;

/* Layout */
background-size: 16px;
background-repeat: no-repeat;
background-image: var(--menuitem-image);
background-position: left 4px center;
padding-inline-start: 24px; /* 16p + (4px * 2) */
background-position: var(--uc-menu-background-position, left) 4px center;
&:dir(rtl) {
--uc-menu-background-position: right;
}
}
4 changes: 2 additions & 2 deletions src/icons/layout/_bookmark_menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ $_bookmarkToolbarMenus: selector.nest(
}
@include _layoutBookmarkMenu() {
margin-inline: var(--arrowpanel-menuitem-padding-inline) !important;
background-position: left calc(var(--arrowpanel-menuicon-padding)) center !important;
background-position: var(--uc-menu-background-position) calc(var(--arrowpanel-menuicon-padding)) center !important;
}
@include _layoutBookmarkPopup() {
padding-inline-start: calc(var(--arrowpanel-menuicon-padding) + var(--context-menu-text-padding) + 2px) !important;
Expand All @@ -82,7 +82,7 @@ $_bookmarkToolbarMenus: selector.nest(
@include _layoutBookmarkMenu() {
margin-inline: var(--arrowpanel-menuitem-padding-inline) !important;
padding-inline-start: calc(var(--arrowpanel-menuicon-padding) + var(--context-menu-text-padding)) !important;
background-position: left calc(var(--arrowpanel-menuicon-padding)) center !important;
background-position: var(--uc-menu-background-position) calc(var(--arrowpanel-menuicon-padding)) center !important;
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/icons/layout/_menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ $_layoutCommonMenus: (
/* Menubar */
@include Option("userChrome.icon.global_menubar") {
#{$_globalMenus} {
background-position: left var(--context-menu-background-padding-default) center !important;
background-position: var(--uc-menu-background-position) var(--context-menu-background-padding-default) center !important;
padding-inline-start: calc(16px + var(--context-menu-background-padding-default)) !important;
padding-inline-end: 3px;

&:first-child {
background-position: left calc(3px + var(--context-menu-background-padding-default)) center !important;
background-position: var(--uc-menu-background-position) calc(3px + var(--context-menu-background-padding-default)) center !important;
padding-inline-start: calc(19px + var(--context-menu-background-padding-default)) !important;
}
> menupopup {
Expand Down
6 changes: 5 additions & 1 deletion src/icons/layout/_menu_common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,16 @@ $_initialMenus: selector.append(
// Padding
@mixin _layout_root_padding() {
:root {
--uc-menu-background-position: left;
--context-menu-background-padding-default: 5px;
--context-menu-background-padding: var(--context-menu-background-padding-default);
&:-moz-locale-dir(rtl) {
--uc-menu-background-position: right;
}
}
}
@mixin _layout_init_padding() {
background-position: left var(--context-menu-background-padding) center !important;
background-position: var(--uc-menu-background-position) var(--context-menu-background-padding) center !important;
padding-inline-start: var(--context-menu-background-padding) !important;
}

Expand Down

0 comments on commit 734ed69

Please sign in to comment.