Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for screen reader announcements in code block document elements. #16056

Closed
wants to merge 13 commits into from

Conversation

Mati365
Copy link
Member

@Mati365 Mati365 commented Mar 19, 2024

Suggested merge commit message (convention)

Feature (code-block): Introduced screen reader announcements for entering or exiting code block elements in the document editor. Closes #16053.

@Mati365 Mati365 requested review from oleq and DawidKossowski March 19, 2024 08:56
@Mati365 Mati365 marked this pull request as draft March 19, 2024 10:59
@Mati365 Mati365 marked this pull request as ready for review March 19, 2024 14:19
packages/ckeditor5-code-block/src/codeblockediting.ts Outdated Show resolved Hide resolved
Comment on lines +285 to +289
if ( direction === 'enter' ) {
return t( 'Entering code snippet' );
}

return t( 'Leaving code snippet' );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can safely assume there will never be a code snippet without the language upcasted in the editor. See

if ( !codeBlock.hasAttribute( 'language' ) ) {
writer.setAttribute( 'language', defaultLanguageName, codeBlock );
}
. I'd assume that element.getAttribute( 'language' )!.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can happen if language passed to codeBlock has no language definition specified in config (like FooBar). I'd stay with a bit more verbose but safer approach.

@Mati365 Mati365 changed the title Add aria-label attributes to code-block document element. Add support for screen reader announcements for code block elements in a document. Mar 21, 2024
@Mati365 Mati365 changed the title Add support for screen reader announcements for code block elements in a document. Add support for screen reader announcements in code block document elements. Mar 21, 2024
@Mati365
Copy link
Member Author

Mati365 commented Mar 21, 2024

@oleq Can you take a look again?

@Mati365 Mati365 requested a review from oleq March 21, 2024 08:31
@Mati365 Mati365 requested a review from scofalik April 3, 2024 13:22
@Mati365 Mati365 closed this Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add aria-label to code block
2 participants