Skip to content

Build your personal knowledge base with Trilium Notes

client/collections/board: tweak the grouping attribute dropdown

Adorian Doran037b065db848
diff --git a/apps/client/src/widgets/collections/board/group_by.spec.tsx b/apps/client/src/widgets/collections/board/group_by.spec.tsx
index b6a997c34a..1e922dee99 100644
--- a/apps/client/src/widgets/collections/board/group_by.spec.tsx
+++ b/apps/client/src/widgets/collections/board/group_by.spec.tsx
@@ -193,6 +193,25 @@ describe("BoardGroupBy", () => {
expect(create).toBe(divider + 1);
});
+ /**
+ * The grouping in force is ticked, and stays open to the reader: a shut entry reads as one the
+ * board refuses rather than the one it is already on. Picking it again changes nothing.
+ */
+ it("ticks the grouping in force, and leaves it open to be picked again", async () => {
+ const { mountPoint, onSelect } = await setup("priority");
+ const [ status, priority ] = items(mountPoint);
+
+ expect(priority.querySelector(".bx-check")).toBeTruthy();
+ expect(status.querySelector(".bx-check")).toBeNull();
+ expect(priority.classList.contains("disabled")).toBe(false);
+
+ act(() => { (priority as HTMLElement).click(); });
+ expect(onSelect).not.toHaveBeenCalled();
+
+ act(() => { (status as HTMLElement).click(); });
+ expect(onSelect).toHaveBeenCalledWith("status");
+ });
+
it("opens the editor on a promoted, inheritable select that cannot be changed", async () => {
const { mountPoint } = await setup();
diff --git a/apps/client/src/widgets/collections/board/group_by.tsx b/apps/client/src/widgets/collections/board/group_by.tsx
index 98db56eb3e..0494192f70 100644
--- a/apps/client/src/widgets/collections/board/group_by.tsx
+++ b/apps/client/src/widgets/collections/board/group_by.tsx
@@ -111,9 +111,14 @@ export default function BoardGroupBy({ note, options, current, onSelect }: {
{options.map(option => (
<FormListItem
key={option.value}
- onClick={() => onSelect(option.value)}
- selected={option.value === current}
- disabled={option.value === current}
+ // The one in force is ticked rather than held shut, which would read as a
+ // grouping the board refuses. Picking it again changes nothing.
+ checked={option.value === current}
+ onClick={() => {
+ if (option.value !== current) {
+ onSelect(option.value);
+ }
+ }}
>{option.title}</FormListItem>
))}