Skip to content

[Segmented] Left arrow key not propagating to parent when at leftmost item #745

@tomokuni

Description

@tomokuni

Describe the bug

Title:
[Segmented] Left arrow key not propagating to parent when at leftmost item

Description:
When the focus is on the leftmost SegmentedItem in a Segmented control and the left arrow key (←) is pressed, the key event is consumed by the control instead of being propagated to the parent for XY focus navigation.

Current Behavior:

  • Right arrow (→): Works correctly - when at the rightmost item, the key is NOT consumed and propagates to parent
  • Left arrow (←): Does NOT work - when at the leftmost item, the key IS consumed and does NOT propagate to parent

Expected Behavior:
Both left and right arrow keys should behave symmetrically:

  • When at the boundary, the key event should be propagated to the parent for XY focus navigation
  • This allows focus to move to adjacent Segmented controls in parent containers

Root Cause:
In Segmented.cs, the MoveFocus(MoveDirection direction) method has asymmetric behavior:

The Bug:

  • When at the left boundary, retVal = true is set, which means the key is marked as "handled"
  • When at the right boundary, retVal is not modified (remains false), meaning the key is NOT marked as "handled"
  • This asymmetry breaks XY focus navigation with multiple Segmented controls

Fix:
Remove the else { retVal = true; } block in the Previous direction case, or add equivalent handling for the Next direction:

Steps to reproduce

When the focus is on the leftmost `SegmentedItem` in a `Segmented` control and the left arrow key (←) is pressed, the key event is consumed by the control instead of being propagated to the parent for XY focus navigation.

Expected behavior

左右の矢印キーは対称的に動作すべきです:

  • 境界位置では、XYフォーカスナビゲーションのためキーイベントを親に伝播する
  • これにより、親コンテナ内の隣接するSegmentedコントロールへフォーカスが移動可能となる

Screenshots

No response

Code Platform

  • UWP
  • WinAppSDK / WinUI 3
  • Web Assembly (WASM)
  • Android
  • iOS
  • MacOS
  • Linux / GTK

Windows Build Number

  • Windows 10 1809 (Build 17763)
  • Windows 10 1903 (Build 18362)
  • Windows 10 1909 (Build 18363)
  • Windows 10 2004 (Build 19041)
  • Windows 10 20H2 (Build 19042)
  • Windows 10 21H1 (Build 19043)
  • Windows 10 21H2 (Build 19044)
  • Windows 10 22H2 (Build 19045)
  • Windows 11 21H2 (Build 22000)
  • Other (specify)

Other Windows Build number

Windows11 25H2

App minimum and target SDK version

  • Windows 10, version 1809 (Build 17763)
  • Windows 10, version 1903 (Build 18362)
  • Windows 10, version 1909 (Build 18363)
  • Windows 10, version 2004 (Build 19041)
  • Windows 10, version 2104 (Build 20348)
  • Windows 11, version 22H2 (Build 22000)
  • Other (specify)

Other SDK version

10.0.17763.0

Visual Studio Version

Preview

Visual Studio Build Number

Visual Studio 2026

Device form factor

Desktop

Additional context

No response

Help us help you

No, I'm unable to contribute a solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions