CommunityToolkit / CommunityToolkit/Windows
SettingsExpander's internal SettingsCard using its Button content's as AutomationProperties.Name
- Lenguaje dominante
- C#
- Estrellas
- 1.1k
- Forks
- 166
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
### Describe the bug
When a SettingsCard's content is a button, it automatically sets its `AutomationProperties.Name` value to the button's content (as we can see [here](https://github.com/CommunityToolkit/Windows/blob/main/components/SettingsControls/src/SettingsCard/SettingsCard.cs#L100)). This is not always desirable and can lead to some bugs with the narrator as the screenshots below shows.
In the SettingsCard, a simple workaround is to set the `AutomationProperties.Name` manually. But in the SettingsExpander, there is no way to change the behavior of its internal SettingsCard. This SettingCard then inherits the Content of the button, which in some cases may not even be a text (it is an icon in our case), and then the narrator when focusing the button, narrates it as the name of the group the button is in (in the case the button have an accessible name different than its content, which is also our case).
A current workaround for it is to put the button inside another control of different type, a StackPanel for example, but it has the cost of nesting one more group into the UI.
My suggestion is that the SettingsExpander's SettingsCard should not always use its button's content as accessible name, but either use the Title of the card or having the possibility of the developer to choose if want this behavior or not when using the control. Or maybe this internal SettingsCard should not have any accessible name at all.
### Steps to reproduce
```text
- Create a SettingsExpander.
- Set its content to be a button.
- Have the button to have a AutomationProperties.Name different from its content.
- Activate the narrator and focus the button.
```
### Expected behavior
The narrator should say:
[Title of the SettingsExpander] group. [AutomationProperties.Name of the button] button.
Instead of:
[Content of the button] group. [AutomationProperties.Name of the button] button.
### Screenshots


### Code Platform
- [ ] UWP
- [X] 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)
- [X] Windows 11 21H2 (Build 22000)
- [ ] Other (specify)
### Other Windows Build number
_No response_
### 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
_No response_
### Visual Studio Version
2022
### Visual Studio Build Number
_No response_
### Device form factor
Desktop
### Additional context
_No response_
### Help us help you
No, I'm unable to contribute a solution.
Guía de contribución
Línea de trabajo
Empieza con components/SettingsControls/src/SettingsCard/SettingsCard.cs en la lógica vinculada al nombre de automatización y, a continuación, sigue cómo SettingsExpander crea y configura su SettingsCard interna. Reproduce el escenario de WinUI 3 con un botón cuyo AutomationProperties.Name difiera de su contenido y verifica que Narrator anuncie el título del expander como nombre del grupo y el nombre accesible del botón como nombre del botón.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- csharp
- Área
- accessibility, desktop
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100