Accessibility.Enable
Accessibility.Enable
#Overview
name: Accessibility.Enable
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If false, all queries from accessible APIs will be ignored. On some platforms, the application must be restarted in order to take effect.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of Accessibility.Enable is to control whether accessibility features are enabled in the Unreal Engine application. This setting variable is used to manage the accessibility system, allowing developers to enable or disable accessibility queries and features.
This setting variable is primarily utilized by the ApplicationCore module, specifically within the accessibility subsystem. Based on the callsites, it’s evident that the GenericAccessibleInterfaces component relies on this variable to determine whether accessibility features should be active.
The value of this variable is set through a console variable, which allows it to be modified at runtime. It is associated with the GAllowAccessibility boolean variable, and they share the same value.
The GAllowAccessibility variable interacts directly with Accessibility.Enable. It’s used in conjunction with other internal flags to determine if the application should respond to accessibility queries and activate accessibility features.
Developers must be aware of several important aspects when using this variable:
- Changing this setting may require a restart of the application on some platforms to take effect fully.
- When set to false, all queries from accessible APIs will be ignored, effectively disabling accessibility features.
- This variable acts as a global switch for accessibility, overriding other accessibility-related settings if set to false.
Best practices when using this variable include:
- Consider the needs of your target audience and enable accessibility features by default unless there’s a compelling reason not to.
- Provide a clear way for users to toggle this setting within your application’s user interface.
- Document any platform-specific behavior related to changing this setting, especially if a restart is required.
- Test your application thoroughly with this setting both enabled and disabled to ensure proper functionality in all cases.
Regarding the associated variable GAllowAccessibility:
The purpose of GAllowAccessibility is to serve as the internal representation of the Accessibility.Enable setting. It’s a boolean flag that directly controls whether accessibility features are allowed in the application.
This variable is used within the ApplicationCore module, specifically in the GenericAccessibleInterfaces component. It’s checked in various functions to determine if accessibility features should be active or if accessibility-related queries should be processed.
The value of GAllowAccessibility is set through the Accessibility.Enable console variable, allowing it to be modified at runtime.
GAllowAccessibility interacts with other internal flags, such as bApplicationIsAccessible and bIsActive, to determine the overall accessibility state of the application.
Developers should be aware that:
- This variable acts as a global switch for accessibility features.
- It’s used in conjunction with other flags to determine the final accessibility state.
- Modifying this variable directly (rather than through the console variable) is not recommended, as it may lead to inconsistent behavior.
Best practices for using GAllowAccessibility include:
- Always use the Accessibility.Enable console variable to modify this setting rather than changing GAllowAccessibility directly.
- When implementing new accessibility features, check this flag to ensure they should be active.
- Consider the performance implications of frequently checking this flag in performance-critical code paths.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/ApplicationCore/Private/GenericPlatform/Accessibility/GenericAccessibleInterfaces.cpp:10
Scope: file
Source code excerpt:
bool GAllowAccessibility = false;
FAutoConsoleVariableRef AllowAccessibilityRef(
TEXT("Accessibility.Enable"),
GAllowAccessibility,
TEXT("If false, all queries from accessible APIs will be ignored. On some platforms, the application must be restarted in order to take effect.")
);
FGenericAccessibleMessageHandler::FGenericAccessibleMessageHandler()
: bApplicationIsAccessible(false)
#Associated Variable and Callsites
This variable is associated with another variable named GAllowAccessibility
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/ApplicationCore/Private/GenericPlatform/Accessibility/GenericAccessibleInterfaces.cpp:8
Scope: file
Source code excerpt:
/** A flag that can be set by a user to force accessibility off regardless of other settings. */
bool GAllowAccessibility = false;
FAutoConsoleVariableRef AllowAccessibilityRef(
TEXT("Accessibility.Enable"),
GAllowAccessibility,
TEXT("If false, all queries from accessible APIs will be ignored. On some platforms, the application must be restarted in order to take effect.")
);
FGenericAccessibleMessageHandler::FGenericAccessibleMessageHandler()
: bApplicationIsAccessible(false)
, bIsActive(false)
#Loc: <Workspace>/Engine/Source/Runtime/ApplicationCore/Private/GenericPlatform/Accessibility/GenericAccessibleInterfaces.cpp:23
Scope (from outer to inner):
file
function bool FGenericAccessibleMessageHandler::ApplicationIsAccessible
Source code excerpt:
bool FGenericAccessibleMessageHandler::ApplicationIsAccessible() const
{
return bApplicationIsAccessible && GAllowAccessibility;
}
void FGenericAccessibleMessageHandler::SetActive(bool bActive)
{
bActive &= GAllowAccessibility;
if (bActive != bIsActive)
{
bIsActive = bActive;
if (bIsActive)
{