Skip to content

TabGroup not always navigate correctly across groups #4080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
BDisp opened this issue May 12, 2025 · 1 comment · May be fixed by #4085
Open

TabGroup not always navigate correctly across groups #4080

BDisp opened this issue May 12, 2025 · 1 comment · May be fixed by #4085
Labels
bug v2 For discussions, issues, etc... relavant for v2
Milestone

Comments

@BDisp
Copy link
Collaborator

BDisp commented May 12, 2025

Maybe I could be wrong but group navigation should always respect the current focused view in the current focused group.

    [Theory]
    [ClassData (typeof (V2TestDrivers))]
    public void Toplevel_TabGroup_Forward_Backward (V2TestDriver d)
    {
        var v1 = new View { Id = "v1", CanFocus = true };
        var v2 = new View { Id = "v2", CanFocus = true };
        var v3 = new View { Id = "v3", CanFocus = true };
        var v4 = new View { Id = "v4", CanFocus = true };

        using GuiTestContext c = With.A<Window> (50, 20, d)
                                     .Then (
                                            () =>
                                            {
                                                var w1 = new Window { Id = "w1" };
                                                w1.Add (v1, v2);
                                                var w2 = new Window { Id = "w2" };
                                                w2.Add (v3, v4);
                                                Toplevel top = Application.Top!;
                                                Application.Top!.Add (w1, w2);
                                            })
                                     .WaitIteration ()
                                     .Then (() => Assert.True (v3.HasFocus))
                                     .RaiseKeyDownEvent (Key.F6)
                                     .Then (() => Assert.True (v1.HasFocus))
                                     .RaiseKeyDownEvent (Key.F6)
                                     .Then (() => Assert.True (v3.HasFocus))
                                     .RaiseKeyDownEvent (Key.F6.WithShift)
                                     .Then (() => Assert.True (v1.HasFocus))
                                     .RaiseKeyDownEvent (Key.F6.WithShift)
                                     .Then (() => Assert.True (v3.HasFocus))
                                     .RaiseKeyDownEvent (Key.Tab)
                                     .Then (() => Assert.True (v4.HasFocus))
                                     .RaiseKeyDownEvent (Key.F6)
                                     .Then (() => Assert.True (v1.HasFocus))
                                     .RaiseKeyDownEvent (Key.F6)
                                     .Then (() => Assert.True (v4.HasFocus)) // Fails because it navigates to the previous view v3
                                     .RaiseKeyDownEvent (Key.F6.WithShift)
                                     .Then (() => Assert.True (v1.HasFocus))
                                     .RaiseKeyDownEvent (Key.Tab)
                                     .Then (() => Assert.True (v2.HasFocus))
                                     .RaiseKeyDownEvent (Key.F6.WithShift)
                                     .Then (() => Assert.True (v4.HasFocus))
                                     .RaiseKeyDownEvent (Key.F6.WithShift)
                                     .Then (() => Assert.True (v2.HasFocus))
                                     .WriteOutLogs (_out)
                                     .Stop ();
        Assert.False (v1.HasFocus);
        Assert.False (v2.HasFocus);
        Assert.False (v3.HasFocus);
        Assert.False (v4.HasFocus);
    }
@BDisp BDisp added bug v2 For discussions, issues, etc... relavant for v2 labels May 14, 2025
@BDisp BDisp added this to the V2 Alpha milestone May 14, 2025
BDisp added a commit to BDisp/Terminal.Gui that referenced this issue May 14, 2025
@BDisp BDisp linked a pull request May 14, 2025 that will close this issue
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug v2 For discussions, issues, etc... relavant for v2
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

2 participants
@BDisp and others