Using Controls and Programmatic Focus to Bypass Blocks of Content in Silverlight

Important Information about Techniques

See Understanding Techniques for WCAG Success Criteria for important information about the usage of these informative techniques and how they relate to the normative WCAG 2.1 success criteria. The Applicability section explains the scope of the technique, and the presence of techniques for a specific technology does not imply that the technology can be used in all situations to create content that meets WCAG 2.1.

Applicability

Note

Microsoft has stopped updating and distributing Silverlight, and authors are encouraged to use HTML for accessible web content.

This technique relates to Success Criterion 2.4.1: Bypass Blocks (Sufficient as a way to meet an unwritten technique).

Description

The objective of this technique is to use the combination of Silverlight control activation and programmatic focus to enable the user to skip regions of content in a Silverlight application user interface.

The control that the user activates should clearly indicate that its purpose is to skip content, so that the resulting programmatic focus shift is not interpreted as an undesired change of context.

The object to call focus to (the receiver of focus after the user-initiated action is triggered) has to be a Control in the Silverlight programming model. This is because the Focus method must be called on the target, and therefore the target must inherit the Control class. So, an application author might call focus to a read-only TextBox, or perhaps a RichTextBox, depending on the purpose of the Silverlight application and its user interface design. You can also focus a UserControl, for cases where the area to call focus to represents a custom control implementation.

Examples

Example 1: User-enabled control that programmatically sets focus

The following is the XAML for the user interface.

   <StackPanel Name="LayoutRoot">
       <Button Name="bypassbtn1" Click="bypassbtn1_Click">Skip menus, go to main page content</Button>
       <!intervening content-->
       <StackPanel>
           <RichTextBox Name="rtb_MainContent" IsReadOnly="True">
           <Paragraph>Here is the main content ....</Paragraph>
           </RichTextBox>
       </StackPanel>
   </StackPanel>
   

The following is the event handler that forces focus.

       private void bypassbtn1_Click(object sender, RoutedEventArgs e)
       {
           rtb_MainContent.Focus();
       }

This example is shown in operation in the working example of Programmatic Focus.

Resources

Resources are for information purposes only, no endorsement implied.

Tests

Procedure

  1. Open the test HTML page for a Silverlight application.
  2. Check for a control that indicates that activating that control can skip to some particular region of the content.
  3. Activate that control. Verify that activating the control causes focus to go to that region, and that a repeated block or blocks of content are skipped.

Expected Results

#2 and #3 are true.