Skip to content

Conversation

@mou-haz
Copy link
Contributor

@mou-haz mou-haz commented Sep 24, 2025

Resolves #358.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes keyboard event bubbling issues in the NavigationView control by implementing a mechanism to selectively prevent key events from bubbling up when they've been handled. The change addresses issues where ScrollViewer and AutoSuggestBox TextBox components were marking events as handled, preventing proper bubbling to KeyboardFocusManager.

Key changes:

  • Added a class-level KeyDown event handler that resets event handled state based on a flag
  • Introduced NoNeedToBubbleKeyEvents flag to control when events should not bubble
  • Updated all focus navigation methods to set this flag when they successfully handle key events
  • Removed fallback focus navigation logic from FocusNextDownItem method
Comments suppressed due to low confidence (2)

source/iNKORE.UI.WPF.Modern.Controls/Controls/Windows/NavigationView/NavigationView.cs:3018

  • The FocusNextRightItem method is missing the NoNeedToBubbleKeyEvents flag assignment that was added to other focus navigation methods (FocusNextUpItem and FocusNextDownItem). When args.Handled is set to true (when MoveFocus succeeds), the flag should also be set to maintain consistent behavior across all focus navigation methods.
        void FocusNextRightItem(NavigationViewItem nvi, KeyEventArgs args)
        {
            args.Handled = nvi.MoveFocus(new TraversalRequest(FocusNavigationDirection.Right));
        }

source/iNKORE.UI.WPF.Modern.Controls/Controls/Windows/NavigationView/NavigationView.cs:2987

  • Corrected spelling of 'otherise' to 'otherwise'.
        // If item has focusable children, move focus to first focusable child, otherise just defer to default XYKeyboardFocus behavior

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

[BUG] Focus navigation doesn't work when navigated to the top on Nav View

1 participant