Skip to content

Conversation

United600
Copy link
Collaborator

@United600 United600 commented Sep 27, 2025

  • In MediaListViewItem.xaml adds explicit AutomationControlType="Button" properties to correctly identify the artist and album hyperlink as buttons
  • Improves automation names for play, artist, and album buttons in MediaListViewItem.xaml.cs
  • Improves SortBy dropdown buttons in both AlbumsPage.xaml and SongsPage.xaml to use a new localized automation name that includes the currently selected sort option
  • Added an override for the ToString() method in LivelyWallpaperModel to provide a more informative string representation

Todo

  • SortBy dropdown buttons - Improve the GetSortByButtonAutomationName() method to not rely on GetSortByText()
  • MediaListViewItem Play button - Use MediaViewModel PropertyChanged (IsPlaying) instead of relying on visual states changes
  • StorageViewModel - Implement accessibility for file/folder items
  • MediaViewModel - Add automation peer support for media items and playback states

This works for both view models but it leaves a lot to be desired:

public override string ToString()
{
    return $"{Name}, {CaptionText/Caption}";
}

For the StorageViewModel it misses support for 'Empty folder' states and pluralization.
And in the MediaViewModel it limits the display of additional details (such as duration and artist) for MediaListViewItems and does not apply to the collection headers (e.g., "A", "B", etc.)."

@United600 United600 requested a review from Copilot September 27, 2025 14:58
@United600 United600 added the a11y Issues or improvements related to inclusive design or assistive technologies label Sep 27, 2025
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Sep 27, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances screen reader support and accessibility features throughout the application by improving automation properties and adding clearer labels for various UI elements.

  • Adds explicit AutomationControlType="Button" properties to hyperlink buttons for proper identification
  • Implements dynamic automation names for play, artist, and album buttons that reflect current state
  • Improves sort dropdown button accessibility with localized automation names that include the selected option

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Strings/en-US/Resources.resw Adds localized string template for sort button automation names
Pages/SongsPage.xaml.cs Implements helper method to generate descriptive automation names for sort buttons
Pages/SongsPage.xaml Updates sort button to use new dynamic automation name
Pages/AlbumsPage.xaml.cs Implements helper method to generate descriptive automation names for sort buttons
Pages/AlbumsPage.xaml Updates sort button to use new dynamic automation name
Controls/MediaListViewItem.xaml.cs Adds automation name updates for play, artist, and album buttons based on media state
Controls/MediaListViewItem.xaml Adds explicit button control type for artist and album hyperlinks
Core/Models/LivelyWallpaperModel.cs Adds ToString override for better string representation in accessibility contexts

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

var media = DataContext as MediaViewModel;
string playPauseText = isPlaying ? Strings.Resources.Pause : Strings.Resources.Play;

AutomationProperties.SetName(PlayButton, $"{playPauseText} {media?.Name}");
Copy link
Preview

Copilot AI Sep 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential null reference exception if media?.Name is null. The string interpolation will display an empty string, but it would be clearer to provide a fallback value or guard against null media names.

Suggested change
AutomationProperties.SetName(PlayButton, $"{playPauseText} {media?.Name}");
AutomationProperties.SetName(PlayButton, $"{playPauseText} {(string.IsNullOrEmpty(media?.Name) ? Strings.Resources.Unknown : media.Name)}");

Copilot uses AI. Check for mistakes.

Comment on lines +62 to +63
AutomationProperties.SetName(ArtistButton, $"{Strings.Resources.Artist}: {media?.MainArtist?.Name}");
AutomationProperties.SetName(AlbumButton, $"{Strings.Resources.Albums}: {media?.Album?.Name}");
Copy link
Preview

Copilot AI Sep 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If media?.MainArtist?.Name or media?.Album?.Name are null, the automation names will end with ': ' followed by empty text. Consider providing fallback text or checking for null values before setting the automation properties.

Suggested change
AutomationProperties.SetName(ArtistButton, $"{Strings.Resources.Artist}: {media?.MainArtist?.Name}");
AutomationProperties.SetName(AlbumButton, $"{Strings.Resources.Albums}: {media?.Album?.Name}");
var artistName = string.IsNullOrWhiteSpace(media?.MainArtist?.Name) ? Strings.Resources.UnknownArtist : media.MainArtist.Name;
var albumName = string.IsNullOrWhiteSpace(media?.Album?.Name) ? Strings.Resources.UnknownAlbum : media.Album.Name;
AutomationProperties.SetName(ArtistButton, $"{Strings.Resources.Artist}: {artistName}");
AutomationProperties.SetName(AlbumButton, $"{Strings.Resources.Albums}: {albumName}");

Copilot uses AI. Check for mistakes.


public override string ToString()
{
return Model.Author != null ? $"{Model.Title}; {Model.Author}" : $"{Model.Title}";
Copy link
Preview

Copilot AI Sep 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential null reference exception if Model.Title is null. The method should handle the case where Model.Title might be null to prevent runtime exceptions.

Suggested change
return Model.Author != null ? $"{Model.Title}; {Model.Author}" : $"{Model.Title}";
var title = Model?.Title ?? string.Empty;
var author = Model?.Author;
return !string.IsNullOrEmpty(author) ? $"{title}; {author}" : $"{title}";

Copilot uses AI. Check for mistakes.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Sep 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a11y Issues or improvements related to inclusive design or assistive technologies lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants