RadCheckBox accessibility properties

5 posts, 0 answers
  1. Joe
    Joe avatar
    3 posts
    Member since:
    Oct 2016

    Posted 29 Aug Link to this post

    I'm working on making our application compatible with screen reading software. We have a RadCheckBox control on a form. The control is named chkIncludeInActive, and the text is "Include inactive." When the screen reader is enabled and you hover over the control, it says "Check box include inactive include inactive." This is despite the fact that I've set the "Accessible Description" and "Accessible Name" properties on the control both to "1" (for testing purposes). If I open the Element Hierarchy Editor, and I go to the underlying RadCheckBoxElement, I see the "Accessible Description" and "Accessible Name" are both set as "Include inactive." I can override these values in the Element Hierarchy Editor, but once I open up the form in Design mode again, the defaults are back. So it doesn't seem like these changes stick. I want to be able to override these values somehow and make them stick. The version we're using is 2011.1.11.419.
  2. Hristo
    Admin
    Hristo avatar
    1028 posts

    Posted 30 Aug Link to this post

    Hi Joe,

    Thank you for writing.

    The properties you see using the Element Hierarchy Editor are not serialized and that it is why the value you set cannot be persisted. You can set them at run-time by accessing the ButtonElement property: 
    this.radCheckBox1.ButtonElement.AccessibleName = "Accessible Name";
    this.radCheckBox1.ButtonElement.AccessibleDescription = "Accessible Description";

    I hope this helps. Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Joe
    Joe avatar
    3 posts
    Member since:
    Oct 2016

    Posted 30 Aug in reply to Hristo Link to this post

    Thanks for the reply. Hristo, this approach does seem to work, but the LegacyIAccessible.Name and LegacyIAccessible.Description are still being reported as "Include inactive." I think this is because chkIncludeInActive.AccessibilityObject.Description and chkIncludeInActive.AccessibilityObject.Name are still being reported as "Include inactive," and I'm thinking that's where these values are pulled from when read by the screen reader. These values can be seen using the Inspect tool that comes with the Windows SDK. Is there a way to refresh the AccessibilityObject after updating those properties on the ButtonElement?
  4. Joe
    Joe avatar
    3 posts
    Member since:
    Oct 2016

    Posted 30 Aug Link to this post

    I have managed to work around this, though it is painful to need to do this. I extended the stock RadCheckBox and RadCheckBoxAccessibleObject classes to conform to what I believe is the correct behavior for these accessibility attributes. To fix the theme of the checkbox, I return the default theme for RadCheckBox. If there is a better way to accomplish this, please let me know.

    public class CustomRadCheckBox : RadCheckBox
        {
            protected override AccessibleObject CreateAccessibilityInstance()
            {
                return new CustomRadCheckBoxAccessibleObject(this);
            }
     
            [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
            public override string ThemeClassName
            {
                //fixes the theme
                get { return "Telerik.WinControls.UI.RadCheckBox"; }
                set { }
            }
        }
     
        public class CustomRadCheckBoxAccessibleObject : RadCheckBoxAccessibleObject
        {
            public CustomRadCheckBoxAccessibleObject(RadCheckBox owner) : base(owner) { }
     
            public override string Name
            {
                //if not done, the LegacyIAccessible.Name will show as the name of the button
                get { return Owner.AccessibleName; }
                set { }
            }
     
            public override string Description
            {
                //if not done, the LegacyIAccessible.Description will shows as the text of the button
                get { return Owner.AccessibleDescription; }
            }
        }
  5. Hristo
    Admin
    Hristo avatar
    1028 posts

    Posted 31 Aug Link to this post

    Hi Joe,

    Thank you for writing back.

    Indeed the approach you are using now is valid. You can go ahead and since it fits your local setup use it in your project. Please bear in mind that our MSAA support is primarily developed to handle CodedUI tests and the Windows narrator. In this respect, the inspect or other tools may behave differently.

    I hope this helps. Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top