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 the visual label to the beginning of the programmatic heading dropdown aria label #16024

Merged
merged 8 commits into from
Mar 20, 2024

Conversation

Mati365
Copy link
Member

@Mati365 Mati365 commented Mar 14, 2024

Suggested merge commit message (convention)

Fix (heading): Set the visual label to the beginning of the programmatic aria label in heading and language dropdowns.

Closes https://github.com/cksource/ckeditor5-commercial/issues/6029

Copy link
Member

@oleq oleq left a comment

Choose a reason for hiding this comment

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

The solution is correct. What we're missing:

  • unit tests,

and as per original issue

The same issue exists in other dropdown controls.

  • an integration with text part language (the aria-label is "Language" but it displays "French")
image

@@ -124,6 +124,21 @@ export default class HeadingUI extends Plugin {
return titles[ whichModel ];
} );

dropdownView.buttonView.bind( 'ariaLabel' ).to( headingCommand, 'value', paragraphCommand, 'value', ( value, para ) => {
const whichModel = value || para && 'paragraph';
Copy link
Member

Choose a reason for hiding this comment

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

Since we're visiting this code for the first time since 2018, can you please rewrite it to human-readable code using if/else or at least the ternary operator? 🙂 (I know you copied it from dropdownView.buttonView.bind( 'label' )..., you can change it there too)

Copy link
Member Author

Choose a reason for hiding this comment

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

I reduced this one line to const whichModel = paragraph ? 'paragraph' : heading;. Seems to be working correctly.

@oleq oleq merged commit 571bcf5 into master Mar 20, 2024
6 checks passed
@oleq oleq deleted the ck/6029 branch March 20, 2024 13:26
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.

2 participants