Skip to content

Commit e74ffd5

Browse files
authored
fix(language-menu): always render inter-locale links (#11013)
* feat(dropdown): add alwaysRenderChildren option * fix(language-menu): always render links to other locales
1 parent c9fc3de commit e74ffd5

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

Diff for: client/src/app.scss

+4
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ main {
186186
width: 1px !important;
187187
}
188188

189+
.contents {
190+
display: contents;
191+
}
192+
189193
.hidden {
190194
display: none;
191195
}

Diff for: client/src/ui/molecules/dropdown/index.tsx

+8-1
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,11 @@ export function DropdownMenuWrapper({
5454

5555
export function DropdownMenu({
5656
children,
57+
alwaysRenderChildren = false,
5758
onClose = () => {},
5859
}: {
5960
children: React.ReactNode;
61+
alwaysRenderChildren?: boolean;
6062
onClose?: (event?: Event) => void;
6163
}) {
6264
const { isOpen, wrapperRef, close, disableAutoClose } =
@@ -82,7 +84,12 @@ export function DropdownMenu({
8284
onClose(event);
8385
}
8486
});
85-
if (!isOpen) return null;
87+
88+
if (alwaysRenderChildren) {
89+
return <div className={isOpen ? "contents" : "hidden"}>{children}</div>;
90+
} else if (!isOpen) {
91+
return null;
92+
}
8693

8794
return <>{children}</>;
8895
}

Diff for: client/src/ui/organisms/article-actions/language-menu/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export function LanguageMenu({
9595
{native}
9696
</Button>
9797

98-
<DropdownMenu>
98+
<DropdownMenu alwaysRenderChildren>
9999
<Submenu menuEntry={menuEntry} />
100100
</DropdownMenu>
101101
</DropdownMenuWrapper>

0 commit comments

Comments
 (0)