Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Implemented the aria-expanded attribute support on the SplitButtonVie…
Browse files Browse the repository at this point in the history
…w#arrowView element.
  • Loading branch information
oleq committed Aug 12, 2019
1 parent d7b20b8 commit 8662c0b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/dropdown/button/splitbuttonview.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,15 @@ export default class SplitButtonView extends View {
*/
_createArrowView() {
const arrowView = new ButtonView();
const bind = arrowView.bindTemplate;

arrowView.icon = dropdownArrowIcon;

arrowView.extendTemplate( {
attributes: {
class: 'ck-splitbutton__arrow',
'aria-haspopup': true
'aria-haspopup': true,
'aria-expanded': bind.to( 'isOn', value => String( value ) )
}
} );

Expand Down
8 changes: 8 additions & 0 deletions tests/dropdown/button/splitbuttonview.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ describe( 'SplitButtonView', () => {
expect( view.element.classList.contains( 'ck-splitbutton_open' ) ).to.be.false;
} );

it( 'binds arrowView aria-expanded attribute to #isOn', () => {
view.arrowView.isOn = true;
expect( view.arrowView.element.getAttribute( 'aria-expanded' ) ).to.equal( 'true' );

view.arrowView.isOn = false;
expect( view.arrowView.element.getAttribute( 'aria-expanded' ) ).to.equal( 'false' );
} );

describe( 'activates keyboard navigation for the toolbar', () => {
it( 'so "arrowright" on view#arrowView does nothing', () => {
const keyEvtData = {
Expand Down

0 comments on commit 8662c0b

Please sign in to comment.