🐛 defer dropdown action to fix SidePanel outside-interaction close, trim question text
Browse files at this commitbb9d401d7cc58dcfd04db9f16595359c7244df18Parent: 2911d65- fix
- 🐛 defer dropdown action to fix SidePanel outside-interaction close, trim question text
2 changed files +7 -3
src/components/ui/table-row-actions.tsxmodified+5 -1
| @@ -33,7 +33,11 @@ export function TableRowActions(props: { label: string; actions: TableRowAction[ | |||
| 33 | class="flex h-10 items-center gap-2.5 rounded-xl px-3 text-xs font-medium" | 33 | class="flex h-10 items-center gap-2.5 rounded-xl px-3 text-xs font-medium" |
| 34 | destructive={action.destructive} | 34 | destructive={action.destructive} |
| 35 | disabled={action.disabled} | 35 | disabled={action.disabled} |
| 36 | - onSelect={action.onSelect} | 36 | + // Defer to the next macrotask so the menu fully closes (and |
| 37 | + // restores focus to its trigger) before the action opens a | ||
| 38 | + // panel/dialog — otherwise the non-modal SidePanel reads that | ||
| 39 | + // focus-restore as an outside interaction and instantly closes. | ||
| 40 | + onSelect={() => setTimeout(action.onSelect, 0)} | ||
| 37 | > | 41 | > |
| 38 | {action.icon} | 42 | {action.icon} |
| 39 | <span>{action.label}</span> | 43 | <span>{action.label}</span> |
src/pages/question-bank-page.tsxmodified+2 -2
| @@ -108,7 +108,7 @@ function QuestionBankContent() { | |||
| 108 | { | 108 | { |
| 109 | accessorKey: "text", | 109 | accessorKey: "text", |
| 110 | header: t("questions.text"), | 110 | header: t("questions.text"), |
| 111 | - cell: (cell) => <p class="truncate font-medium">{cell.row.original.text}</p>, | 111 | + cell: (cell) => <p class="max-w-[24rem] truncate font-medium">{cell.row.original.text}</p>, |
| 112 | }, | 112 | }, |
| 113 | { | 113 | { |
| 114 | accessorKey: "kind", | 114 | accessorKey: "kind", |
| @@ -233,7 +233,7 @@ function QuestionBankContent() { | |||
| 233 | } | 233 | } |
| 234 | columns={columns()} | 234 | columns={columns()} |
| 235 | data={list()?.items ?? []} | 235 | data={list()?.items ?? []} |
| 236 | - tableClass="table-fixed min-w-6xl" | 236 | + tableClass="min-w-6xl" |
| 237 | filterPlaceholder={t("bank.search")} | 237 | filterPlaceholder={t("bank.search")} |
| 238 | searchValue={query()} | 238 | searchValue={query()} |
| 239 | onSearchInput={(value) => { | 239 | onSearchInput={(value) => { |