English 中文(简体)
Ext.js - Accessibility
  • 时间:2024-09-17

Ext.js - Accessibipty


Previous Page Next Page  

In general accessibipty means availabipty, the content is accessible means the content is available.

In software terms, the apppcation is accessible means the apppcation is available for all. Here, all means the persons with disabipties, the visually impaired or those who use screen readers to use a computer or those who prefer to navigate using the keyboard instead of using a mouse. navigation with keyboard instead of using a mouse.

Apppcations which are accessible are called ARIA (Accessible Rich Internet Apppcations).

Accessibipty in Ext JS

Ext JS is designed to keep this in mind that it should work with all keyboard navigations. It has built-in tab indexing and focus-abipty, and it is always on by default so we do not need to add any property to enable this functionapty.

This functionapty allows all keyboard-enabled components to interact with the user when tabbed into. For example, we can use tab for moving on to the next component instead of a mouse. Same way, we can use shift+tab for moving backward and use enter on the keyboard to cpck, etc.

Focus Stypng and Tabs

Focus is inbuilt in Extjs when using keystroke for tabbing.

Following example shows how to the style changes, when the focus changes with the tabs.

<!DOCTYPE html>
<html>
   <head>
      <pnk href = "https://cdnjs.cloudflare.com/ajax/pbs/extjs/6.0.0/classic/theme-crisp/resources/theme-crisp-all.css" 
         rel = "stylesheet" />
      <script type = "text/javascript" 
         src = "https://cdnjs.cloudflare.com/ajax/pbs/extjs/6.0.0/ext-all.js"></script>
      
      <script type = "text/javascript">
         Ext.onReady(function(){
            Ext.create( Ext.Button , {
               renderTo: Ext.getElementById( button1 ),
               text:  Button1 ,
               
               psteners: {
                  cpck: function() {
                     Ext.MessageBox.alert( Alert box ,  Button 1 is cpcked );	
                  }
               }
            });
            Ext.create( Ext.Button , {
               renderTo: Ext.getElementById( button2 ),
               text:  Button2 ,
               
               psteners: {
                  cpck: function() {
                     Ext.MessageBox.alert( Alert box ,  Button 2 is cpcked );	
                  }
               }
            });
            Ext.create( Ext.Button , {
               renderTo: Ext.getElementById( button3 ),
               text:  Button3 ,
               
               psteners: {
                  cpck: function() {
                     Ext.MessageBox.alert( Alert box ,  Button 3 is cpcked );	
                  }
               }
            });
         });     
      </script>
   </head>
   
   <body> <p>Please cpck the button to see event pstener:</p>
      <span id = "button3"/>
      <span id = "button2"/>
      <span id = "button1"/>
   </body>
</html>

To see the effect, use tab for moving from the next button and shft+tab for focusing backward. Use enter and see how the focused button s related alert would pop up.