Skip to content

feat(editor): remember whether the string details are expanded - #22363

Open
anishkun wants to merge 1 commit into
WeblateOrg:mainfrom
anishkun:feat/remember-details-accordion
Open

anishkun wants to merge 1 commit into
WeblateOrg:mainfrom
anishkun:feat/remember-details-accordion

Conversation

@anishkun

Copy link
Copy Markdown
Contributor

The Details accordion in the translation context panel (unit identifier, string age, last updated, ...) is collapsed on every page load, so a translator who needs it has to reopen it on each string.

Change

weblate/static/editor/full.js stores the accordion state in localStorage under translate-details when it is opened or closed, and restores it on the next string. This follows the existing translate-tab and zen-suggestions keys, as discussed in the issue. The restore sets the show class and the toggle's collapsed / aria-expanded state before Bootstrap creates the collapse instance, so the panel does not animate open on every string and screen readers get the correct expanded state. Reading and writing localStorage is wrapped in try/catch as in zen.js: when storage is unavailable, the panel stays collapsed by default and still works on the page.

Verification

New Selenium test test_string_details_stay_open: opens the details on one string, checks that they are open with aria-expanded="true" and no animation on another string, then closes them there and checks that this is remembered as well.

  • With the patch: passes. The rest of test_selenium.py also passes (67 of 68), apart from test_backup, which fails locally because the container's pg_dump does not match the PostgreSQL 18 server.
  • Unpatched full.js: fails with AssertionError: None != 'shown'.
  • Two deliberately broken variants are also caught: never restoring the state ('show' not found in 'accordion-collapse collapse') and restoring the panel without updating aria-expanded ('false' != 'true').
  • biome check 2.6.2 and ruff 0.17.2 are clean on the touched files.

Left alone

  • No profile setting, as agreed in the issue.
  • No template change: the panel is selected by its existing string-info-details-<id> id. The accordion exists only in translate.html (Zen mode has none), so nothing else needs the same treatment.

Fixes #21991

The Details accordion in the translation context panel was collapsed on
every page load, so translators who rely on the string age or unit
identifier had to reopen it on each string. Store the open state in
localStorage, the same way the editor remembers the selected tab and Zen
mode remembers whether suggestions are shown, and restore it before
Bootstrap sets up the collapse so the panel does not animate on every
string.

Fixes WeblateOrg#21991
@anishkun
anishkun requested a review from nijel as a code owner October 25, 2026 08:06
@nijel nijel added this to the 2026.11 milestone Oct 25, 2026
@nijel nijel self-assigned this Oct 25, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-25T13:07:42.801824Z
We couldn’t complete this review. Comment @codex review to try again.
4bf69a1 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

This comment was marked as off-topic.

@WeblateOrg WeblateOrg deleted a comment from chatgpt-codex-connector Bot Oct 25, 2026
@nijel
nijel requested a review from KarenKonou October 25, 2026 14:59

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support keeping string details visible

2 participants