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

Autocomplete widget should use bound item.label property as a fallback for empty aria-label. #2282

Open
mikhail-shipaev opened this issue Aug 20, 2024 · 3 comments

Comments

@mikhail-shipaev
Copy link

// Announce the value in the liveRegion
label = ui.item.attr( "aria-label" ) || item.value;
if ( label && String.prototype.trim.call( label ).length ) {

When li element in the dropdown list has an empty "aria-label" attribute current implementation fallbacks to using bound item.value for aria-label.

It'd be more logical using item.label for fallback instead.
Additionally this may lead to js exception when item.value is not of "string" type because in the next line it's passed to String.prototype.trim function that accepts only string arguments.

@mgol
Copy link
Member

mgol commented Aug 23, 2024

Thanks for the report. Does the issue you describe exist when jQuery UI 1.12.1 is used or only with jQuery UI 1.13.0 or newer?

@mikhail-shipaev
Copy link
Author

mikhail-shipaev commented Sep 6, 2024 via email

@mgol
Copy link
Member

mgol commented Sep 6, 2024

Thanks for the info. Can you provide a test case on JS Bin? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants