Skip to content

Persist expandable menu state#4527

Open
gingyx wants to merge 7 commits intoDSpace:mainfrom
atmire:w2p-127493_persist-expandable-menu-state_contribute-main
Open

Persist expandable menu state#4527
gingyx wants to merge 7 commits intoDSpace:mainfrom
atmire:w2p-127493_persist-expandable-menu-state_contribute-main

Conversation

@gingyx
Copy link

@gingyx gingyx commented Jul 3, 2025

References

Fixes #3193

Description

This PR persists the expanded/collapsed state of all menus through a designated cookie.

Instructions for Reviewers

List of changes in this PR:

  1. Updated MenuService with a new type PinnedMenuCookie and related constants to manipulate the cookie named 'dsMenuCollapsedState'.
  2. Updated MenuService with isCollapsed, toggleMenuCollapsedState and syncMenuCollapsedState to manipulate the pinned menu cookie.
  3. Added a method configureMenuCollapsedState to InitService that initializes the correct menu states. Updated classes that extend InitService to call that method in init().
  4. Added a new class MenuEffects that makes sure toggleMenuCollapsedState gets called for every toggle menu action.
  5. Updated HostWindowService to assume desktop width during SSR, to better initialize menus that have their cookie state set to expanded.

How to test or review the PR:

  • Pin the admin sidebar menu.
  • Refresh the page.
  • Verify that the admin sidebar menu is still pinned.

Checklist

  • My PR is created against the main branch of code (unless it is a backport or is fixing an issue specific to an older branch).

  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.

  • My PR passes ESLint validation using npm run lint

  • My PR doesn't introduce circular dependencies (verified via npm run check-circ-deps)

  • My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.

  • My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.

  • My PR aligns with Accessibility guidelines if it makes changes to the user interface.

  • My PR uses i18n (internationalization) keys instead of hardcoded English text, to allow for translations.

  • My PR includes details on how to test it. I've provided clear instructions to reviewers on how to successfully test this fix or feature.

  • If my PR includes new libraries/dependencies (in package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.

  • If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself.

  • If my PR fixes an issue ticket, I've linked them together.

@gingyx gingyx added the bug label Jul 3, 2025
@gingyx gingyx marked this pull request as ready for review July 3, 2025 11:51
return menuKeySelector<string[]>(id, menuSectionIndexStateSelector);
};

export const PINNED_MENU_COOKIE = 'dsMenuCollapsedState';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gingyx : Just quick feedback on this. Any new cookies need to be added to the "Cookie Settings" (in UI footer) via Orejime. We also need to offer users the ability to disable any cookies which are not required. (Obviously if they disable the cookie though, then this feature will not be available.)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback! I just pushed the requested changes.

@tdonohue tdonohue moved this to 🙋 Needs Reviewers Assigned in DSpace 10.0 Release Jul 3, 2025
@tdonohue tdonohue added component: administrative tools Related to the admin menu or tools improvement labels Jul 3, 2025
@github-actions
Copy link

Hi @gingyx,
Conflicts have been detected against the base branch.
Please resolve these conflicts as soon as you can. Thanks!

@gingyx gingyx force-pushed the w2p-127493_persist-expandable-menu-state_contribute-main branch from c5abfad to ca3bbe5 Compare March 16, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: 🙋 Needs Reviewers Assigned

Development

Successfully merging this pull request may close these issues.

Persist "Pin sidebar"

2 participants