fix(menu): highlight active nav tab in non-English locales#41183
fix(menu): highlight active nav tab in non-English locales#41183rusackas wants to merge 2 commits into
Conversation
Code Review Agent Run #e666b5Actionable Suggestions - 0Additional Suggestions - 1
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
The flagged issue regarding key collisions in the navigation menu is correct. Using To resolve this, you should ensure keys are unique by namespacing them, for example by incorporating the parent's name or a unique identifier into the child's key. In I have checked the other comments on this PR, and there are no additional actionable review comments to address. Would you like me to proceed with implementing this fix in superset-frontend/src/features/home/Menu.tsx |
The top navigation highlighted the active tab by matching the current
route against hardcoded English strings ("Dashboards", "Charts", "SQL",
etc.) while menu items were keyed by their localized labels. In any
non-English locale the localized label never matched the English key, so
no tab was highlighted (issue #36403).
Key each menu item by its stable Flask-AppBuilder `name` (which is
locale-independent) instead of its displayed label, and match the active
tab against those same names. Highlighting now works regardless of the
selected interface language.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
e27418c to
d1fb926
Compare
The SQL Editor child is labeled "SQL Lab" and sits under the "SQL Lab" category, so keying the child by its label collided with the parent key. Key children by their stable FAB `name` (falling back to the label) so AntD menu selection/open-state stays unambiguous. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #41183 +/- ##
=======================================
Coverage 64.31% 64.31%
=======================================
Files 2651 2651
Lines 144773 144775 +2
Branches 33407 33409 +2
=======================================
+ Hits 93111 93118 +7
+ Misses 49992 49987 -5
Partials 1670 1670
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Code Review Agent Run #66af40Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
SUMMARY
The top navigation bar highlights the active tab by matching the current route against the menu item keys. Those keys were the menu items' displayed labels, while the active-tab matcher compared against hardcoded English strings (
"Dashboards","Charts","SQL", …). In any non-English locale the displayed label is translated, so it never matched the English comparison string and no tab was highlighted.This is a systemic i18n bug — it affects every language whose menu translations differ from English, not just Russian (reported in #36403).
Fix: key each menu item by its stable Flask-AppBuilder
name(the internal view/category identifier, which is locale-independent) instead of its localized label, and match the active tab against those same names.namefalls back tolabelwhen absent, so operator-defined custom menu entries keep working.The change is in
superset-frontend/src/features/home/Menu.tsx:buildMenuItemnow useskey: name ?? labelfor top-level entries.Dashboards,Charts,Datasets,SQL Lab) instead of English labels. As a bonus this decouples the Datasets tab from the semantic-layer label override.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before — Russian locale, on the Dashboards page, the Dashboards tab is not highlighted.
After — the active tab is highlighted in every language.
(See the screenshots in #36403 for the broken-vs-working comparison.)
TESTING INSTRUCTIONS
superset_config.py:Automated coverage added in
Menu.test.tsx:ADDITIONAL INFORMATION
🤖 Generated with Claude Code