question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TabView only supports closing tabs with a pointer device

See original GitHub issue

Describe the bug It is not possible to close a TabViewItem using just the keyboard - likely ALLY issue.

Steps to reproduce the bug

  1. In a blank app, add a TabView control.
  2. Add some TabViewItems to the TabItems collection.
  3. Add a handler for the TabCloseRequested event.
  4. Set a break point in the event handler.
    <winui:TabView
        TabCloseRequested="OnTabCloseRequested">
        <winui:TabView.TabItems>
            <winui:TabViewItem Header="Item 1" />
            <winui:TabViewItem Header="Item 2" />
            <winui:TabViewItem Header="Item 3" />
        </winui:TabView.TabItems>
    </winui:TabView>
  1. Run the app.
  2. Try and close a tab without using a mouse, pen, finger, or other pointing device. i.e. just using keyboard (or a connected controller.)

Expected behavior The break point will never be hit! It should be possible to close a tab without having to use a pointing device. Without this it is not possible to provide a fully accessible experience using this control.

Screenshots button in question is highlighted in the screenshot below image

Version Info

NuGet package version: Microsoft.UI.Xaml 2.2.190917002

Windows 10 version Saw the problem?
Insider Build (xxxxx)
May 2019 Update (18362) Yes
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes>
Mobile
Xbox
Surface Hub
IoT

Additional context This issue was discovered as part of investigation into https://github.com/microsoft/WindowsTemplateStudio/issues/3407

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
mrlaceycommented, Nov 22, 2019

By “mousewheel” we mean “middle click” (which is usually done by the mousewheel).

Yes, I was middle-clicking with the mousewheel but it did not realize the cursor has to be over the tab and this doesn’t work if the cursor is over the tab’s content.

I think just offering a default context menu seems best. That makes it more obvious for keyboard and gamepad users.

A default content item would be a good solution. Also having the Ctrl+F4 shortcut documented somewhere a user might possibly find it would also be good. I expect to see it as a tool-tip on on the close button.

0reactions
github-actions[bot]commented, Jul 28, 2023

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TabView Class - Windows App SDK
Tab controls are useful for displaying several pages (or documents) of content while giving a user the capability to rearrange, open, or close...
Read more >
NSTabViewController | Apple Developer Documentation
A container view controller that manages a tab view interface, which organizes multiple pages of content but displays only one page at a...
Read more >
Swiftui: How to Close one Tab in a TabView?
However, I don't know how to close only one Tab Element. I've tried to use dismiss() and dynamically changing vm.images element. Latter one ......
Read more >
Tabview (lv_tabview)
New tabs can be added with lv_tabview_add_tab(tabview, "Tab name") . It will return with a pointer to a Page object where the tab's...
Read more >
Disable new iOS 15's transparent TabView : r/SwiftUI
Since iOS 15, the tab bar will have a transparent background when there is a scrollview and that scrollview is scrolled to the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found