Skip to content

Commit

Permalink
Merge pull request #16550 from ckeditor/ck/16544
Browse files Browse the repository at this point in the history
Fix (UI): The aria-live views will no longer violate the a11y aXe rule: `landmarks should be unique`. Closes #16544.
  • Loading branch information
DawidKossowski authored Jun 13, 2024
2 parents 07840aa + a524de9 commit 50c09aa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion packages/ckeditor5-ui/src/arialiveannouncer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ export class AriaLiveAnnouncerRegionView extends View {
this.setTemplate( {
tag: 'div',
attributes: {
role: 'region',
'aria-live': politeness,
'aria-relevant': 'additions'
},
Expand Down
6 changes: 3 additions & 3 deletions packages/ckeditor5-ui/tests/editorui/arialiveannouncer.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe( 'AriaLiveAnnouncer', () => {
expect( firstRegion.politeness ).to.equal( 'polite' );
expect( firstRegion.element.parentNode ).to.equal( announcer.view.element );

expect( firstRegion.element.getAttribute( 'role' ) ).to.equal( 'region' );
expect( firstRegion.element.getAttribute( 'role' ) ).to.be.null;
expect( firstRegion.element.getAttribute( 'aria-live' ) ).to.equal( 'polite' );
expect( firstRegion.element.querySelector( 'li' ).innerHTML ).to.equal( 'bar' );
} );
Expand All @@ -73,7 +73,7 @@ describe( 'AriaLiveAnnouncer', () => {
expect( firstRegion.politeness ).to.equal( 'polite' );
expect( firstRegion.element.parentNode ).to.equal( announcer.view.element );

expect( firstRegion.element.getAttribute( 'role' ) ).to.equal( 'region' );
expect( firstRegion.element.getAttribute( 'role' ) ).to.be.null;
expect( firstRegion.element.getAttribute( 'aria-live' ) ).to.equal( 'polite' );
expect( firstRegion.element.querySelector( 'li:last-child' ).innerHTML ).to.equal( 'baz' );
} );
Expand Down Expand Up @@ -188,6 +188,6 @@ describe( 'AriaLiveAnnouncerRegionView', () => {
} );

function queryAllMessages() {
return [ ...announcerRegionView.element.querySelectorAll( 'div[role="region"] ul li' ) ].map( element => element.innerHTML );
return [ ...announcerRegionView.element.querySelectorAll( 'div[aria-live] ul li' ) ].map( element => element.innerHTML );
}
} );

0 comments on commit 50c09aa

Please sign in to comment.