[PR #7522] [MERGED] feat(lorebooks): collapse long keyword lists in the native editor #7776

Closed
opened 2026-10-24 04:07:24 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7522
Author: @minikkeuen
Created: 10/13/2026
Status: ✅ Merged
Merged: 10/14/2026
Merged by: @SpicyMarinara

Base: staging ← Head: feat/lorebook-keyword-collapse


📝 Commits (9)

  • 00579fb feat(lorebooks): collapse long keyword lists in the native editor
  • 9892e71 Merge branch 'staging' into feat/lorebook-keyword-collapse
  • 4e1674f Merge branch 'staging' into feat/lorebook-keyword-collapse
  • df324e8 Merge branch 'staging' into feat/lorebook-keyword-collapse
  • 374d2a1 Merge branch 'staging' into feat/lorebook-keyword-collapse
  • fd1a524 fix(lorebooks): address keyword collapse review feedback
  • acd9bf2 Merge origin/staging into feat/lorebook-keyword-collapse
  • 30844ce Merge branch 'staging' into feat/lorebook-keyword-collapse
  • 588b9f9 Merge branch 'staging' into feat/lorebook-keyword-collapse

📊 Changes

4 files changed (+309 additions, -5 deletions)

View changed files

➕ e2e/lorebook-keyword-visibility.e2e.ts (+207 -0)
📝 packages/client/src/components/lorebooks/LorebookFormFields.tsx (+29 -5)
📝 packages/client/src/localization/locales/en.json (+2 -0)
➕ scripts/regressions/lorebook-keyword-visibility.regression.mjs (+71 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #7521

Why this change

  • Lorebook entries with many keywords can take up excessive vertical space, making the editor harder to navigate.
  • Collapsing long keyword lists improves readability while keeping keyword management accessible.

What changed

  • Display the first 10 keywords by default when a list contains more than 10.
  • Add expand/collapse controls to reveal or hide the remaining keywords.
  • Maintain independent expansion states for primary and secondary keywords.
  • Automatically expand the list when a new keyword is added.
  • Preserve keyword input values when interacting with the toggle.
  • Use existing editor styles, localized labels, and accessibility attributes.
  • Add rendering and browser regression tests.
  • Keep keyword storage, matching logic, and APIs unchanged.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Launched the development app in an isolated environment.
  • Manually verified that the keyword expand/collapse functionality works in the browser.
  • Confirmed that the UI behaves as expected during manual testing.
  • Rendering regression tests and existing keyword scanning regression tests passed.
  • Browser E2E tests were added but have not been executed.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

Collapsed keyword lists

Displays the first 10 keywords in each list, with a button to reveal the remaining keywords.

Collapsed primary and secondary keyword lists

Expanded keyword list

Shows all primary keywords when expanded, while the secondary keyword list remains collapsed independently.

Expanded primary keyword list with secondary keywords collapsed

Summary by CodeRabbit

  • New Features
    • Lorebook keyword lists show up to 10 keys by default, with a control to reveal or hide additional keys. Adding a new key expands the list; adding a duplicate does not.
    • The disclosure control provides accessible labels and state, and the keyword list remains editable when collapsed.
  • Bug Fixes
    • Opening or closing the disclosure no longer commits an unfinished key edit. Ordinary focus changes retain the existing auto-add behavior, and adding or removing visible keys preserves hidden keys.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/7522 **Author:** [@minikkeuen](https://github.com/minikkeuen) **Created:** 10/13/2026 **Status:** ✅ Merged **Merged:** 10/14/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `feat/lorebook-keyword-collapse` --- ### 📝 Commits (9) - [`00579fb`](https://github.com/Pasta-Devs/Marinara-Engine/commit/00579fb35d741cade99582f850401a6ac39082e6) feat(lorebooks): collapse long keyword lists in the native editor - [`9892e71`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9892e719c1643dbbf3e8b753bc8374da36f79798) Merge branch 'staging' into feat/lorebook-keyword-collapse - [`4e1674f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4e1674fa02acf4894086795b069c86e1f7ea7692) Merge branch 'staging' into feat/lorebook-keyword-collapse - [`df324e8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/df324e8dbaacc8de7967cf27e4102913b9a72568) Merge branch 'staging' into feat/lorebook-keyword-collapse - [`374d2a1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/374d2a1a4bdc41bf9898b1f5d6b51deecc29bba2) Merge branch 'staging' into feat/lorebook-keyword-collapse - [`fd1a524`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fd1a524d43795771a3aaf5e9c0cb597927b1af33) fix(lorebooks): address keyword collapse review feedback - [`acd9bf2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/acd9bf2e37a40a0f638a7a03edbbe8a9681ef6c6) Merge origin/staging into feat/lorebook-keyword-collapse - [`30844ce`](https://github.com/Pasta-Devs/Marinara-Engine/commit/30844ce8f7f463ae1f5b8b4fab579e72844d659e) Merge branch 'staging' into feat/lorebook-keyword-collapse - [`588b9f9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/588b9f9cbf5f7cf1de139b08bd3f68d18a8e31c2) Merge branch 'staging' into feat/lorebook-keyword-collapse ### 📊 Changes **4 files changed** (+309 additions, -5 deletions) <details> <summary>View changed files</summary> ➕ `e2e/lorebook-keyword-visibility.e2e.ts` (+207 -0) 📝 `packages/client/src/components/lorebooks/LorebookFormFields.tsx` (+29 -5) 📝 `packages/client/src/localization/locales/en.json` (+2 -0) ➕ `scripts/regressions/lorebook-keyword-visibility.regression.mjs` (+71 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. ## Linked issue Closes #7521 ## Why this change - Lorebook entries with many keywords can take up excessive vertical space, making the editor harder to navigate. - Collapsing long keyword lists improves readability while keeping keyword management accessible. ## What changed - Display the first 10 keywords by default when a list contains more than 10. - Add expand/collapse controls to reveal or hide the remaining keywords. - Maintain independent expansion states for primary and secondary keywords. - Automatically expand the list when a new keyword is added. - Preserve keyword input values when interacting with the toggle. - Use existing editor styles, localized labels, and accessibility attributes. - Add rendering and browser regression tests. - Keep keyword storage, matching logic, and APIs unchanged. ## Validation - [x] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Launched the development app in an isolated environment. - Manually verified that the keyword expand/collapse functionality works in the browser. - Confirmed that the UI behaves as expected during manual testing. - Rendering regression tests and existing keyword scanning regression tests passed. - Browser E2E tests were added but have not been executed. ## Docs and release impact - [x] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) ### Collapsed keyword lists Displays the first 10 keywords in each list, with a button to reveal the remaining keywords. <img width="570" height="232" alt="Collapsed primary and secondary keyword lists" src="https://github.com/user-attachments/assets/77c349b5-fe90-488d-a745-7d19420b4ea1" /> ### Expanded keyword list Shows all primary keywords when expanded, while the secondary keyword list remains collapsed independently. <img width="673" height="448" alt="Expanded primary keyword list with secondary keywords collapsed" src="https://github.com/user-attachments/assets/a9a583ef-345b-4516-a656-7b0fe1710edb" /> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Lorebook keyword lists show up to 10 keys by default, with a control to reveal or hide additional keys. Adding a new key expands the list; adding a duplicate does not. * The disclosure control provides accessible labels and state, and the keyword list remains editable when collapsed. * **Bug Fixes** * Opening or closing the disclosure no longer commits an unfinished key edit. Ordinary focus changes retain the existing auto-add behavior, and adding or removing visible keys preserves hidden keys. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:07:24 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#7776
No description provided.