Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Adding accessibility tags to a label seems to cause the renderer to need more space #2580

Closed
raymondjstone opened this issue May 2, 2018 · 9 comments · Fixed by #4433
Closed
Assignees
Labels
a/a11y 🔍 e/5 🕔 5 i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often m/high impact ⬛ p/Android t/bug 🐛

Comments

@raymondjstone
Copy link

Description

Adding accessibility tags to a label seems to cause the renderer to need more space for the label when it is in stacklayouts (Horizontal orientated ones especially). Given accessibility tags are not visible there should be no requirement for more space surely

Steps to Reproduce

  1. create a series of labels such they they use up the screen width on a horizontal stacklayout
  2. add accessibility tags to the labels

Expected Behavior

Labels should show the same with and without the tags

Actual Behavior

Labels seem to 'need' more space on the screen and affect the layour

Basic Information

  • Version with issue: all possibly, am on the current version
  • Last known good version: none
  • IDE: VS 2017 15.6.7
  • Platform Target Frameworks:4.9.0.763
    • iOS: 11.9.1.24
    • Android: 8.2.0.16
    • UWP: n/a
  • Android Support Library Version:
  • Nuget Packages:
  • Affected Devices:

Screenshots

Reproduction Link

@hartez
Copy link
Contributor

hartez commented May 2, 2018

Is this occurring on all platforms or a specific platform? Could you post an example layout (code or XAML) which demonstrates this?

I've tried the following layout to reproduce this problem, but both sets of labels lay out identically:

<StackLayout>

	<StackLayout Orientation="Horizontal" >

		<Label Text="Label 1" />
		<Label Text="Label 2" />
		<Label Text="Label 3" />
		<Label Text="Label 4" />
		<Label Text="Label 5" />
		<Label Text="Label 6" />
		<Label Text="Label 7" />
		<Label Text="Label 8" />

	</StackLayout>

	<StackLayout Orientation="Horizontal" >

		<Label Text="Label 1" AutomationId="label1" />
		<Label Text="Label 2" AutomationId="label2" />
		<Label Text="Label 3" AutomationId="label3" />
		<Label Text="Label 4" AutomationId="label4" />
		<Label Text="Label 5" AutomationId="label5" />
		<Label Text="Label 6" AutomationId="label6" />
		<Label Text="Label 7" AutomationId="label7" />
		<Label Text="Label 8" AutomationId="label8" />

	</StackLayout>

</StackLayout>

Am I missing a step to reproduce this?

@hartez hartez added the s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. label May 2, 2018
@raymondjstone
Copy link
Author

raymondjstone commented May 3, 2018

You are not setting the name nor the helptext fields and I am also setting the inaccessibletree flag to true (not sure if that is the default for labels or not). I am not at work at the moment so can't post a specific example but the issue gets worse as the name or helptext fields get longer it seemed

@raymondjstone
Copy link
Author

ok, some info

Firstly I mostly test on Android (easier when using VS2017 on windows), so by the time I deploy to IOS I had fixed the issue so issue is certainly on Android but I have no reason to believe it is not on IOS as well

I am only using C# not XAML for this, and all objects go through the same code (unless data bound), labels cause issues as described above but when I switched to using images but with the exact same accessibility settings the layout was fine.

The settings used are as following (labeledby is null in these cases, and the sanitize function currently does nothing except adjust the text to correct some bad pronunciations, intree is a bool that is true, name and helptext are strings )

        AutomationProperties.SetIsInAccessibleTree(o, inTree);
        if (inTree)
        {
            AutomationProperties.SetName(o, sanitize(name));
            AutomationProperties.SetHelpText(o, sanitize(helptext));
            if (labeledby != null)
            {
                AutomationProperties.SetLabeledBy(o, labeledby);
            }
        }

@raymondjstone
Copy link
Author

oh and please note you should have something visible below the accessible stacklayout as well, that way you should see it move down further than it should be

@hartez
Copy link
Contributor

hartez commented May 3, 2018

It looks like the problem only exists on Android, and setting AutomationProperties.HelpText and AutomationProperties.Name will trigger it. If you run the attached repro project on Android, the two rows of Labels do not line up; on the other platforms they do.

_2580 Repro.zip

@hartez hartez added t/bug 🐛 p/Android and removed s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. labels May 3, 2018
@raymondjstone
Copy link
Author

Thanks for the update and more accurate diagnosis

@samhouts samhouts added e/5 🕔 5 i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often a/a11y 🔍 labels Aug 1, 2018
@samhouts samhouts added this to the 3.4.0 milestone Oct 19, 2018
@rmarinho rmarinho self-assigned this Nov 15, 2018
rmarinho added a commit that referenced this issue Nov 15, 2018
@rmarinho rmarinho removed this from the 3.4.0 milestone Nov 21, 2018
hartez pushed a commit that referenced this issue Nov 21, 2018
* [Controls]Add repo for issue #2580

* [Android] Clear Hint before sizing Label

* [Controls]Update issue 2580 with more info
@pamela032709
Copy link

ex:
it expands to the size of the help text string only on Android. never happen on ios.

@pamela032709
Copy link

Is this occurring on all platforms or a specific platform? Could you post an example layout (code or XAML) which demonstrates this?

I've tried the following layout to reproduce this problem, but both sets of labels lay out identically:

<StackLayout>

	<StackLayout Orientation="Horizontal" >

		<Label Text="Label 1" />
		<Label Text="Label 2" />
		<Label Text="Label 3" />
		<Label Text="Label 4" />
		<Label Text="Label 5" />
		<Label Text="Label 6" />
		<Label Text="Label 7" />
		<Label Text="Label 8" />

	</StackLayout>

	<StackLayout Orientation="Horizontal" >

		<Label Text="Label 1" AutomationId="label1" />
		<Label Text="Label 2" AutomationId="label2" />
		<Label Text="Label 3" AutomationId="label3" />
		<Label Text="Label 4" AutomationId="label4" />
		<Label Text="Label 5" AutomationId="label5" />
		<Label Text="Label 6" AutomationId="label6" />
		<Label Text="Label 7" AutomationId="label7" />
		<Label Text="Label 8" AutomationId="label8" />

	</StackLayout>

</StackLayout>

Am I missing a step to reproduce this?

Add helptext to each of those labels, add for example "tap here to access ..........many things ", add a long string to each of those labels. so they will all expand according to the size of the string.

@raymondjstone
Copy link
Author

It's meant to be fixed on 3.5 and above I believe but I have not had a chance to check yet HOWEVER the issue only happens when the accessibility help text is longer than the original label text and your example above is not setting that and so should not have the issue. This is a different field to the Automation ID field

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/a11y 🔍 e/5 🕔 5 i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often m/high impact ⬛ p/Android t/bug 🐛
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants