Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/codegen/Common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,12 @@ const common = {
.optional({ default: false })
.setDescription('Whether this group should mark pages as completed when the user finishes'),
),
new CG.prop(
'expandedByDefault',
new CG.bool()
.optional({ default: false })
.setDescription('Whether the sidebar group should be expanded by default'),
),
),
IPagesSettingsWithGroups: () =>
new CG.obj(
Expand Down
7 changes: 5 additions & 2 deletions src/features/navigation/components/PageGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,11 @@ function PageGroupMultiple({
const buttonId = `navigation-button-${group.id}`;
const listId = `navigation-page-list-${group.id}`;

const [isOpen, setIsOpen] = useState(containsCurrentPage);
useLayoutEffect(() => setIsOpen(containsCurrentPage), [containsCurrentPage]);
const [isOpen, setIsOpen] = useState(containsCurrentPage || !!group.expandedByDefault);
useLayoutEffect(
() => setIsOpen(containsCurrentPage || !!group.expandedByDefault),
[containsCurrentPage, group.expandedByDefault],
);

const pageGroupHasErrors = validations !== ContextNotProvided && validations.hasErrors.group;
const pageGroupIsComplete = validations !== ContextNotProvided && validations.isCompleted.group;
Expand Down
Loading