Skip to content

Commit

Permalink
Name, role, value accessibility fixes (#16295)
Browse files Browse the repository at this point in the history
Fix (restricted-editing): Improved the accessibility of the restricted editing dropdown by setting the correct ARIA role on the toolbar menu.

Fix (minimap): Addressed the issue of the minimap `<iframe>` being unnecessarily exposed to assistive technologies.   

---------

Co-authored-by: Aleksander Nowodzinski <a.nowodzinski@cksource.com>
  • Loading branch information
Mati365 and oleq authored May 7, 2024
1 parent ffe310e commit 04a8c63
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/ckeditor5-minimap/src/minimapiframeview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export default class MinimapIframeView extends IframeView {
this.extendTemplate( {
attributes: {
tabindex: -1,
'aria-hidden': 'true',
class: [
'ck-minimap__iframe'
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ export default class RestrictedEditingModeUI extends Plugin {
listItems.add( this._getButtonDefinition( commandName, label, keystroke ) );
} );

addListToDropdown( dropdownView, listItems );
addListToDropdown( dropdownView, listItems, {
role: 'menu'
} );

dropdownView.buttonView.set( {
label: t( 'Navigate editable regions' ),
Expand Down Expand Up @@ -141,6 +143,7 @@ export default class RestrictedEditingModeUI extends Plugin {
withText: true,
keystroke,
withKeystroke: true,
role: 'menuitem',
_commandName: commandName
} )
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ describe( 'RestrictedEditingModeUI', () => {
expect( button ).to.have.property( 'isOn', false );
} );

it( 'has role="menu" attribute set in items list', () => {
dropdown.isOpen = true;

expect( dropdown.panelView.children.first.role ).to.be.equal( 'menu' );
} );

describe( 'exceptions navigation buttons', () => {
beforeEach( () => {
dropdown.render();
Expand All @@ -84,6 +90,7 @@ describe( 'RestrictedEditingModeUI', () => {
expect( button.withKeystroke ).to.be.true;
expect( button.label ).to.equal( 'Previous editable region' );
expect( button.keystroke ).to.equal( 'Shift+Tab' );
expect( button.role ).to.equal( 'menuitem' );
} );

it( 'should have one that goes forward', () => {
Expand All @@ -95,6 +102,7 @@ describe( 'RestrictedEditingModeUI', () => {
expect( button.withKeystroke ).to.be.true;
expect( button.label ).to.equal( 'Next editable region' );
expect( button.keystroke ).to.equal( 'Tab' );
expect( button.role ).to.equal( 'menuitem' );
} );

it( 'should focus the view after executing the command', () => {
Expand Down

0 comments on commit 04a8c63

Please sign in to comment.