Fix inconsistent position of translation buttons across admin contexts#914
Open
rypptc wants to merge 2 commits intowagtail:mainfrom
Open
Fix inconsistent position of translation buttons across admin contexts#914rypptc wants to merge 2 commits intowagtail:mainfrom
rypptc wants to merge 2 commits intowagtail:mainfrom
Conversation
|
Thanks for tackling this, the root cause analysis in #911 is genuinely excellent, probably the best-documented issue in this repo. The fix is on the right track. What works wellExtracting shared logic into translation_buttons() is exactly the right pattern here. It makes the intent clear and eliminates the duplication that caused the original inconsistency. Registering separate wrappers per hook so each can carry its own priority is the correct architectural decision. A few things worth addressing before merge
None of this is blocking in isolation, the core fix is sound. With a comment or two explaining the priority choices and a test, this is ready to go. Happy to help draft the test if that's useful. |
…dd tests for button priority per hook context
Author
|
Thanks for the thorough review. I've addressed all four points:
|
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.
Fixes #911
Description
The "Translate this page" button appears in different contexts within the Wagtail admin: Page Listing, Page Index, and Page Editor. The "Sync translated pages" button is also affected, as it shares the same priority value within each context.
Its position was inconsistent across these contexts because the hooks defining this behavior used the same priority value, even though each hook operates within a different priority range.
Beyond aesthetics and consistency, the main issue was that in the Page Listing view the button was not visible without scrolling.
As an immediate fix, an internal function has been introduced. This function receives the priority value as a parameter and assigns it through context-specific hook handlers.
AI usage
Used AI assistance to understand the hook priority system and identify appropriate priority values for each context.