Skip to content
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

TabControl doesn't send the name of selected tab to accessibility clients on initial focus #12866

Open
TheQuinbox opened this issue Jan 31, 2025 · 4 comments
Assignees
Labels
tenet-accessibility MAS violation, UIA issue; problems with accessibility standards untriaged The team needs to look at this issue in the next triage

Comments

@TheQuinbox
Copy link

.NET version

9.0.100

Did it work in .NET Framework?

Not tested/verified

Did it work in any of the earlier releases of .NET Core or .NET 5+?

No response

Issue description

Normally, when focusing a tab control using a screen reader, the name of the selected tab is announced. You can even see this in Winforms, by creating a tab control and then tabbing onto it. However, if the tab control gets the initial focus, or is the firstly focused item when you alt+tab back to the window, this doesn't happen. Here's a minimal C# Form to showcase this. I wrote and ran this with the dotnet CLI on Windows 10 IoT LTSC. Tested with NVDA, JAWS, and narrator.

using System;
using System.Drawing;
using System.Windows.Forms;

namespace TabControlTest;

public class Form1 : Form {
	private TabControl tabControl;

	public Form1() {
		Text = "Tab Control Demo";
		ClientSize = new Size(400, 300);
		tabControl = new TabControl {
			Dock = DockStyle.Fill,
			Parent = this
		};
		var tabPage1 = new TabPage("Tab 1");
		var label = new Label {
			Text = "Welcome to Tab 1",
			Location = new Point(20, 20),
			AutoSize = true
		};
		var button = new Button {
			Text = "Click Me!",
			Location = new Point(20, 50),
			Size = new Size(75, 23)
		};
		button.Click += (sender, e) => MessageBox.Show("Button clicked!");
		tabPage1.Controls.Add(label);
		tabPage1.Controls.Add(button);
		tabControl.Controls.Add(tabPage1);
		var tabPage2 = new TabPage("Tab 2");
		var listBox = new ListBox {
			Location = new System.Drawing.Point(20, 20),
			Size = new Size(200, 150)
		};
		listBox.Items.AddRange(new object[] { "Item 1", "Item 2", "Item 3" });
		tabPage2.Controls.Add(listBox);
		tabControl.Controls.Add(tabPage2);
	}

	[STAThread]
	static void Main() {
		ApplicationConfiguration.Initialize();
		Application.Run(new Form1());
	}
}

Steps to reproduce

  1. Start a screen reader.
  2. Run the test app provided above.
  3. Note what the screen reader reports when you land on the tab control.
  4. Tab around the application a few times, exploring the various tabs, and take note of what the screen reader reports after focusing the tab control subsequent times.
  5. For added effect, focus the tab control, then alt+tab out of the window and come back, note what is reported.
@TheQuinbox TheQuinbox added the untriaged The team needs to look at this issue in the next triage label Jan 31, 2025
@Tanya-Solyanik
Copy link
Member

Hi @Liv-Goh @Syareel-Sukeri - could you please investigate if this worked in the .NET Framework and when this scenario regressed. Add the untriaged label when done.

@Tanya-Solyanik Tanya-Solyanik removed the untriaged The team needs to look at this issue in the next triage label Jan 31, 2025
@elachlan elachlan added the tenet-accessibility MAS violation, UIA issue; problems with accessibility standards label Feb 1, 2025
@Liv-Goh
Copy link
Contributor

Liv-Goh commented Feb 3, 2025

We have tested this issue on .NET 8, 9, 10 and .NET Framework 4.8.1 using NVDA and Narrator but unable to repro the issue. When we initially focus on the tab and alt+tab out the window and back, the tab name is still announced.

@TheQuinbox Can you check the screen record below to check is there misunderstanding on the repro steps? Thank you.

12866_NVDA3.mp4
Narrator12866.mp4

@TheQuinbox
Copy link
Author

Hi @Liv-Goh, apologies, it seems I slightly misspoke. It indeed doesn't happen when focusing the window. However, I am still able to reproduce this issue when I first run the app. The tab control gets the first focus, and all I hear is "tab control", not what tab is selected.

@Liv-Goh
Copy link
Contributor

Liv-Goh commented Feb 4, 2025

@TheQuinbox, thanks for correcting us. We managed to reproduce the issue that you encounter.

@Tanya-Solyanik, the issue happens when the focus border is focus on the whole tab control instead of the tab page. This occurs when initially run the project and also occurs sometimes when switch to the tab pages. The issue consistently repro on .NET 6, 8, 9, 10 on initial run and not repro on .NET Framework using Narrator but inconsistently repro on .NET Framework using NVDA

Below are the test results using Narrator and NVDA:

Narrator

12866Narrator_Core.mp4
12866Narrator_Framework.mp4

NVDA

12866NVDA_Core.mp4
12866NVDA_Framework.mp4

@Liv-Goh Liv-Goh added the untriaged The team needs to look at this issue in the next triage label Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tenet-accessibility MAS violation, UIA issue; problems with accessibility standards untriaged The team needs to look at this issue in the next triage
Projects
None yet
Development

No branches or pull requests

5 participants