jquery / jquery/jquery-ui

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

Open
#2,282 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Behavior different from 1.12 Comp: Autocomplete Needs info
Dominant language
JavaScript
Stars
11.3k
Forks
5.2k
PR merge metrics
No merged PRs in 30d

Description

https://github.com/jquery/jquery-ui/blob/54f96eea31b21d9ecb00912261df3e5aaebf8cce/ui/widgets/autocomplete.js#L256-L258

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at ui/widgets/autocomplete.js lines 256-258, linked from the issue. Trace how an empty aria-label fallback is selected and how the value is processed. Done means the fallback uses item.label and does not raise an exception when item.value is not a string; add or update regression coverage for both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, jquery
Domain
accessibility, frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.