Context resolver fix#10983
Conversation
📝 WalkthroughWalkthroughThis PR modifies the UI context resolution logic in UiContextResolver::resolveUiContext(). When handling project page navigation, the resolver now classifies the UI context based on the active navigation section's type rather than its name. If the active section is of type Exclusive, it returns UiCtxProjectOpened; otherwise, including when no active section exists, it returns UiCtxProjectFocused. The remaining resolver behavior for home pages, diagnostics, and fallbacks is unchanged. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
||
| INavigationSection* activeSection = navigationController()->activeSection(); | ||
| if (activeSection) { | ||
| if (activeSection->name() == DEFAULT_NAVIGATION_SECTION) { |
There was a problem hiding this comment.
DEFAULT_NAVIGATION_SECTION - not used anymore
| } | ||
|
|
||
| return context::UiCtxProjectOpened; | ||
| //! No navigation section holds explicit focus. This happens when a popup, |
There was a problem hiding this comment.
can this affect pop-up dialogs?
330a572 to
f9f74b7
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/context/internal/uicontextresolver.cpp (1)
91-111:⚠️ Potential issue | 🟠 Major | 🏗️ Heavy liftVerify modal/native dialogs always create an
Exclusivenavigation section.The new fallback returns
UiCtxProjectFocusedwheneveractiveSection()is null, and the inline rationale only covers the "popup closed without restoring focus" case. If any modal dialog, popover, or context menu in Audacity is shown without first creating anINavigationSectionof typeExclusive(e.g., a native OS dialog, a QtQDialog/QMenuthat bypassesmuse::ui::navigation, or a transient overlay),activeSection()will be null while the dialog is on top — andCTX_PROJECT_FOCUSEDshortcuts (Ctrl+C/Ctrl+V/Ctrl+X/Del/...) will now match and fire against the underlying project view.This is also the unresolved concern raised earlier ("can this affect pop-up dialogs?"). Please confirm that every dialog/popup path on the project page funnels through an
Exclusivenavigation section before merge; otherwise this fix trades the original bug for shortcuts leaking into modal contexts.Run the following to inventory how
Exclusivenavigation sections are created and where native/Qt dialogs may be shown without one:#!/bin/bash # 1) Where are Exclusive navigation sections constructed? rg -nP --type=cpp --type=qml -C3 '\bINavigationSection::Type::Exclusive\b|\bType\s*::\s*Exclusive\b' # 2) Where is NavigationSection(...) constructed/registered with a type argument? rg -nP --type=cpp --type=qml -C2 '\bNavigationSection\s*\{?\s*[^;]*Exclusive' # 3) Possible non-muse modal dialogs that may NOT register a NavigationSection. rg -nP --type=cpp -C2 '\bQDialog\b|\bQMessageBox\b|\bQFileDialog\b|\bQMenu\b|\bexec\(\)|\bexecSync\b' # 4) QML popups/dialogs that may sit on top of the project page. rg -nP --type=qml -C2 '\bPopup\b|\bDialog\b|\bMenu\b|\bStyledDialogView\b' # 5) Confirm activeSection() semantics — does Audacity's NavigationController clear active section # while a non-Exclusive dialog is open, or only when an Exclusive one is active? fd -e cpp -e h navigationcontroller --exec rg -nP -C3 '\bactiveSection\b|\bsetActiveSection\b'
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: 17b785c1-138e-42e4-b455-ca1d7bd0523b
📒 Files selected for processing (1)
src/context/internal/uicontextresolver.cpp
Resolves: #10339
Recommended:
QA: