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

Accessibility Insights: "An onscreen element must not have a null" #768

Closed
robertmuehsig opened this issue Jan 14, 2020 · 1 comment
Closed
Assignees
Labels
Milestone

Comments

@robertmuehsig
Copy link
Contributor

I'm currently try to make our application as accessable as possible and stumbled upon this tool:
https://accessibilityinsights.io/

The tool reports on every ribbon button the following issue:

image

It appears that the root cause is the implementation of the TwoLineLabel.cs:

If the button text has enough space to be on one line the tool will report an error. If there are two lines everything is fine.

I tried the following in the TwoLineLabel.cs (but this didn't solve all issues, because there are some other code paths) and it "worked":

private void UpdateTextRun()
        {
            ...

                if (string.IsNullOrWhiteSpace(this.textRun2.Text))
                {
                    this.textRun2.Visibility = Visibility.Hidden;
                    // this didn't did the trick:
                    //this.textRun2.SetValue(AutomationProperties.IsOffscreenBehaviorProperty, IsOffscreenBehavior.Offscreen);
                }
            }
        }

When I set the textRun2 to "hidden" it seems to be "better"

image

Be aware: I'm not an expert in this area. The accessibility tool gives some good hints, but I'm not sure how important those things are.

If you are interested and need help I could try to make a PR. Maybe you could give me a hint if this "code behind" stuff is OK for you or if I should try to put this in the style or somewhere else.


Environment

  • Fluent.Ribbon v7.1.0
  • Windows 10 (v 1903)
  • .NET Framework 472 & .NET Core 3
@batzen
Copy link
Member

batzen commented Jan 14, 2020

Hiding the second run wouldn't really solve the issue for screen readers. The root cause should be that the control does not provide a proper automation peer. I added quite a few new automation peers but overlooked this one. Will have a look and create a new automation peer.

@batzen batzen self-assigned this Jan 22, 2020
@batzen batzen added this to the Next milestone Jan 22, 2020
@batzen batzen closed this as completed in 205942a Jan 22, 2020
@batzen batzen modified the milestones: Future, 8.0.0 Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants