Accessibility in Angular Split button component

14 Nov 20223 minutes to read

ARIA attributes

The web accessibility makes web content and web applications more accessible for people with disabilities. Mostly it 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 Specified for an action items.
aria-haspopup Indicates the availability and type of interactive splitbutton popup element.
aria-expanded Indicates whether the current state of splitbutton popup can be expanded or collapsed.
aria-owns Identifies elements to define a visual, functional, or contextual parent or child relationship between DOM(Document Object Model) elements where the hierarchy cannot be used to represent the relationship.

Keyboard interaction

Keyboard shortcuts Actions
Esc Closes the 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.
import { Component } from '@angular/core';
import { ItemModel } from '@syncfusion/ej2-angular-splitbuttons';

@Component({
    selector: 'app-root',
    template: `<!-- To Render splitbutton. -->
               <ejs-splitbutton content="Paste" iconCss="e-sb-icons e-paste" [items]='items'></ejs-splitbutton>`
})

export class AppComponent {
  public items: ItemModel[] = [
    {
        text: 'Cut',
        iconCss: 'e-sb-icons e-cut'
    },
    {
        text: 'Copy',
        iconCss: 'e-icons e-copy'
    },
    {
        text: 'Paste',
        iconCss: 'e-sb-icons e-paste'
    }
     ];
}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import { SplitButtonModule } from '@syncfusion/ej2-angular-splitbuttons';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
        SplitButtonModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';

enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);