Repository navigation
Conversation
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
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.jsstores the accordion state inlocalStorageundertranslate-detailswhen it is opened or closed, and restores it on the next string. This follows the existingtranslate-tabandzen-suggestionskeys, as discussed in the issue. The restore sets theshowclass and the toggle'scollapsed/aria-expandedstate 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 writinglocalStorageis wrapped intry/catchas inzen.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 witharia-expanded="true"and no animation on another string, then closes them there and checks that this is remembered as well.test_selenium.pyalso passes (67 of 68), apart fromtest_backup, which fails locally because the container'spg_dumpdoes not match the PostgreSQL 18 server.full.js: fails withAssertionError: None != 'shown'.'show' not found in 'accordion-collapse collapse') and restoring the panel without updatingaria-expanded('false' != 'true').biome check2.6.2 andruff0.17.2 are clean on the touched files.Left alone
string-info-details-<id>id. The accordion exists only intranslate.html(Zen mode has none), so nothing else needs the same treatment.Fixes #21991