ewerspej / epj.Expander.Maui

A simple Expander control for .NET MAUI
MIT License
27 stars 3 forks source link

Accessibility #2

Open IeuanWalker opened 2 weeks ago

IeuanWalker commented 2 weeks ago

The header of expander isn't really accessible (screen reader/ keyboard).

Ive cloned your repo locally to fix these issues, so let me know if you'd like a PR

Screen reader

public static readonly BindableProperty HeaderSemanticDescriptionProperty = BindableProperty.Create(nameof(HeaderSemanticDescription), typeof(string), typeof(Expander), null);
public static readonly BindableProperty HeaderSemanticHintProperty = BindableProperty.Create(nameof(HeaderSemanticHint), typeof(string), typeof(Expander), null);

public string HeaderSemanticDescription
{
    get => (string)GetValue(HeaderSemanticDescriptionProperty);
    set => SetValue(HeaderSemanticDescriptionProperty, value);
}

public string HeaderSemanticHint
{
    get => (string)GetValue(HeaderSemanticHintProperty);
    set => SetValue(HeaderSemanticHintProperty, value);
}

Then in the constructor -

Header.SetBinding(SemanticProperties.DescriptionProperty, new Binding(nameof(HeaderSemanticDescription), source: this));
Header.SetBinding(SemanticProperties.HintProperty, new Binding(nameof(HeaderSemanticHint), source: this));

Keyboard

ewerspej commented 1 week ago

Hey @IeuanWalker , thanks for pointing this out. Sure, you're welcome to post a PR. Please make sure to keep the formatting consistent. So far, I didn't add any .editorconfig and XamlStyler config files.

IeuanWalker commented 1 week ago

@ewerspej no prob, i can do the PR for the semantic properties

But just had a look at ur readme and looks like you're supporting more platforms than my StateButton control does. I only support Android and iOS and no plans to add more (there the only platforms i work with)

So not quite sure what to do as thats the main fix for accessibility.

Could potentially use the statebutton control on android and ios and fall back to the tapgesture for the other platforms.

Let me know what you think.

ewerspej commented 1 week ago

Hi @IeuanWalker ,

Okay, that's problematic, because I do support Windows and MacCatalyst. I haven't had a look at your state button, yet, though.

Anyway, I've added some editor config and XamlStyler rules. Please make sure to follow the naming and styling rules, if you still find a way to solve this. Maybe the semantic properties issue can be solved without your StateButton control? After all, I don't know what other side effects it will come with.

Cheers Julian