Accessibility in JavaScript (ES5) SplitButton control
08 May 2023 / 2 minutes to read
ARIA attributes
The web accessibility makes web content and web applications more accessible for people with disabilities. It especially helps in dynamic content change and development of advanced user interface controls with AJAX, HTML, JavaScript, and related technologies.
SplitButton provides built-in compliance with WAI-ARIA specifications. WAI-ARIA support is achieved through the attributes like aria-expanded, aria-owns and aria-haspopup applied for action item in
SplitButton. It helps the people with disabilities by providing information about the widget for assistive
technology in the screen readers. SplitButton component contains the menuItem role.
Properties
Functionality
menuItem
This role will be specified for an action items.
aria-haspopup
Indicates the availability and type of interactive splitbutton popup element.
aria-expanded
Indicates whether the splitbutton popup can be expanded or collapsed, as well as indicates whether its current state is expanded or collapsed.
aria-owns
Identifies an elements in order to define a visual, functional, or contextual parent/child relationship between DOM elements where the DOM hierarchy cannot be used to represent the relationship.
Keyboard interaction
Keyboard shortcuts
Actions
Esc
Closes the opened popup.
Enter
Opens the popup, or activates the highlighted item and closes the popup.
Space
Opens the popup.
Up
Navigates up or to the previous action item.
Down
Navigates down or to the next action item.
Alt + Up Arrow
Closes the popup.
Alt + Down Arrow
Opens the popup.
Source
Preview
index.js
index.html
styles.css
Copied to clipboard
ej.base.enableRipple(true);var items =[{text:'Cut',iconCss:'e-sb-icons e-cut'},{text:'Copy',iconCss:'e-icons e-copy'},{text:'Paste',iconCss:'e-sb-icons e-paste'}];//To place the icon in SplitButton.var splitBtn =newej.splitbuttons.SplitButton({iconCss:'e-sb-icons e-paste',items: items},'#iconbutton');
Copied to clipboard
<!DOCTYPEhtml><htmllang="en"><head><title>EJ2 SplitButton</title><metacharset="utf-8"><metaname="viewport"content="width=device-width, initial-scale=1.0"><metaname="description"content="Typescript UI Controls"><metaname="author"content="Syncfusion"><linkhref="styles.css"rel="stylesheet"><linkhref="//cdn.syncfusion.com/ej2/21.2.3/ej2-base/styles/material.css"rel="stylesheet"><linkhref="//cdn.syncfusion.com/ej2/21.2.3/ej2-buttons/styles/material.css"rel="stylesheet"><linkhref="//cdn.syncfusion.com/ej2/21.2.3/ej2-popups/styles/material.css"rel="stylesheet"><linkhref="//cdn.syncfusion.com/ej2/21.2.3/ej2-splitbuttons/styles/material.css"rel="stylesheet"><scriptsrc="https://cdn.syncfusion.com/ej2/21.2.3/dist/ej2.min.js"type="text/javascript"></script></head><body><divid="container"><buttonid="iconbutton">Paste</button></div><script>var ele = document.getElementById('container');if(ele){
ele.style.visibility ="visible";}</script><scriptsrc="index.js"type="text/javascript"></script></body></html>