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

[Enhancement] Allow setting true/false accessibility text #5

Open
IeuanWalker opened this issue Apr 6, 2023 · 0 comments
Open

[Enhancement] Allow setting true/false accessibility text #5

IeuanWalker opened this issue Apr 6, 2023 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@IeuanWalker
Copy link
Owner

IeuanWalker commented Apr 6, 2023

Android is possible, but atm cant see a way of doing it on iOS

Android

Add the following method into the platform view to prevent the default announcement -

public override void SendAccessibilityEventUnchecked(AccessibilityEvent? e)
{
	//! important - used to override the default On/Off announcement when it is toggled. Now handled manually in the `SetIsToggled` method
	if (e?.EventType.Equals(EventTypes.ViewClicked) ?? false)
	{
		return;
	}

	base.SendAccessibilityEventUnchecked(e);
}

Then perform manual announcement on IsToggledChanged -

public void SetIsToggled()
{
	AnnounceForAccessibility(_switchView.IsToggled ? _textOn : _textOff);
}

iOS

Cant see a simple way of doing it. By the looks of it the only possible way is by overriding everything, including the 'Double tap to toggle setting'. And rather not handle that text my self as using the built in text will auto use the systems language.

https://stackoverflow.com/questions/52230673/how-can-i-make-an-arbitrary-uiaccessibilityelement-behave-like-a-uiswitch-for-vo

@IeuanWalker IeuanWalker added enhancement New feature or request help wanted Extra attention is needed labels Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant