Skip to content

Commit a03585c

Browse files
committed
fix: Improve mobile navigation
1 parent 0492a8a commit a03585c

File tree

9 files changed

+29
-7
lines changed

9 files changed

+29
-7
lines changed

apps/docs/src/components/fragments/header.tsx

+7
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ const Header: Component = () => {
8383
text="soft"
8484
class="lg:min-w-48 justify-start m-0 group"
8585
onClick={() => {
86+
// Force mobile keyboard to open (first focus must be in user-triggered event handler)
87+
const ghostInput = document.createElement("input");
88+
89+
ghostInput.classList.add("absolute", "opacity-0", "pointer-events-none");
90+
ghostInput.id = "ghost-input";
91+
document.body.appendChild(ghostInput);
92+
ghostInput.focus();
8693
setOpened(!opened());
8794
}}
8895
/>

apps/docs/src/components/fragments/search-palette.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ const SearchPalette: Component<SearchPaletteProps> = (props) => {
164164
if (inputRef() && props.opened && mode()) {
165165
setTimeout(() => {
166166
inputRef()?.focus();
167+
document.getElementById("ghost-input")?.remove();
167168
}, 300);
168169
}
169170
});
@@ -247,7 +248,7 @@ const SearchPalette: Component<SearchPaletteProps> = (props) => {
247248
opened={props.opened}
248249
class="items-start"
249250
shadeClass="bg-opacity-50"
250-
wrapperClass="mt-32"
251+
wrapperClass="mt-3 md:mt-32"
251252
onOverlayClick={() => {
252253
props.setOpened(false);
253254
}}

apps/web/src/context/command-palette/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ const CommandPalette: Component<CommandPaletteProps> = (props) => {
292292
if (inputRef() && props.opened && mode()) {
293293
setTimeout(() => {
294294
inputRef()?.focus();
295+
document.getElementById("ghost-input")?.remove();
295296
}, 300);
296297
}
297298
});
@@ -326,7 +327,7 @@ const CommandPalette: Component<CommandPaletteProps> = (props) => {
326327
opened={props.opened}
327328
class="items-start"
328329
shadeClass="bg-opacity-50"
329-
wrapperClass="mt-32"
330+
wrapperClass="mt-3 md:mt-32"
330331
onOverlayClick={() => {
331332
props.setOpened(false);
332333
}}

apps/web/src/layout/toolbar/index.tsx

+7
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,13 @@ const toolbarViews: Record<string, Component<Record<string, any>>> = {
419419
text="soft"
420420
class="@xl:min-w-48 justify-start m-0 bg-gray-200 group"
421421
onClick={() => {
422+
// Force mobile keyboard to open (first focus must be in user-triggered event handler)
423+
const ghostInput = document.createElement("input");
424+
425+
ghostInput.classList.add("absolute", "opacity-0", "pointer-events-none");
426+
ghostInput.id = "ghost-input";
427+
document.body.appendChild(ghostInput);
428+
ghostInput.focus();
422429
setOpened(true);
423430
}}
424431
/>

apps/web/src/views/dashboard/views/kanban/content-group-column.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import {
2828
useSharedState,
2929
useCommandPalette
3030
} from "#context";
31-
import { createRef } from "#lib/utils";
31+
import { breakpoints, createRef } from "#lib/utils";
3232
import { useContentPieces } from "#lib/composables";
3333

3434
interface ContentGroupColumnProps {
@@ -224,7 +224,8 @@ const ContentGroupColumn: Component<ContentGroupColumnProps> = (props) => {
224224
},
225225
delayOnTouchOnly: true,
226226
delay: 500,
227-
disabled: !hasPermission("manageDashboard"),
227+
fallbackOnBody: true,
228+
disabled: !hasPermission("manageDashboard") || !breakpoints.md(),
228229
ghostClass: "!hidden",
229230
revertOnSpill: true,
230231
onAdd(evt) {
@@ -406,6 +407,7 @@ const ContentGroupColumn: Component<ContentGroupColumnProps> = (props) => {
406407
ghostClass: `:base: border-4 border-gray-200 opacity-50 dark:border-gray-700 children:invisible`,
407408
group: "card",
408409
disabled: !hasPermission("manageDashboard"),
410+
fallbackOnBody: true,
409411
onStart(event) {
410412
props.onDragStart?.();
411413
setActiveDraggablePiece(

apps/web/src/views/dashboard/views/kanban/index.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ const DashboardKanbanView: Component<DashboardKanbanViewProps> = (props) => {
4949
ghostClass: `:base: border-4 border-gray-200 opacity-50 dark:border-gray-700 children:invisible !p-0 !m-2 !mt-0 !h-unset rounded-2xl`,
5050
filter: ".locked",
5151
disabled: !hasPermission("manageDashboard"),
52+
fallbackOnBody: true,
5253
onMove(event) {
5354
return !event.related.classList.contains("locked");
5455
},

apps/web/src/views/dashboard/views/list/content-group-row.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
useSharedState
2323
} from "#context";
2424
import { MiniEditor } from "#components/fragments";
25+
import { breakpoints } from "#lib/utils";
2526

2627
interface ContentGroupRowProps {
2728
contentGroup?: App.ContentGroup | null;
@@ -146,7 +147,8 @@ const ContentGroupRow: Component<ContentGroupRowProps> = (props) => {
146147
},
147148
delayOnTouchOnly: true,
148149
delay: 500,
149-
disabled: !hasPermission("manageDashboard"),
150+
fallbackOnBody: true,
151+
disabled: !hasPermission("manageDashboard") || !breakpoints.md(),
150152
ghostClass: "!hidden",
151153
revertOnSpill: true,
152154
draggable: ".draggable",

apps/web/src/views/dashboard/views/list/content-piece-row.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const ContentPieceRow: Component<ContentPieceRowProps> = (props) => {
4848
},
4949
delayOnTouchOnly: true,
5050
delay: 500,
51-
disabled: !hasPermission("manageDashboard"),
51+
disabled: !hasPermission("manageDashboard") || !breakpoints.md(),
5252
ghostClass: "!hidden",
5353
revertOnSpill: true,
5454
filter: ".locked",

packages/components/src/primitives/overlay.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ const Overlay: Component<OverlayProps> = (props) => {
2020
"class",
2121
"shadeClass",
2222
"portal",
23-
"onOverlayClick"
23+
"onOverlayClick",
24+
"wrapperClass"
2425
]);
2526

2627
return (

0 commit comments

Comments
 (0)