Skip to main content

Search and Top Navigation

#15331 new bug ()

Opened March 30, 2019 02:35PM UTC

Last modified March 30, 2019 02:37PM UTC

Additional variable check related to: Uncaught TypeError: Cannot read property 'value' of undefined

Reported by: finexly Owned by:
Priority: minor Milestone: none
Component: ui.autocomplete Version: 1.12.1
Keywords: Cc:
Blocked by: Blocking:
Description

Regarding the error, which is very common in my application I would like to request a little update, the error is:

Uncaught TypeError: Cannot read property 'value' of undefined

jquery-ui.js:2971


Current Code:

// Announce the value in the liveRegion
label = ui.item.attr("aria-label") || item.value;
if (label && $.trim(label).length) {
    this.liveRegion.children().hide();
    $("<div>").text(label).appendTo(this.liveRegion);
}

Can you please update it to:

...

// Announce the value in the liveRegion
if(typeof item !== "undefined") {
    label = ui.item.attr("aria-label") || item.value;
    if (label && $.trim(label).length) {
        this.liveRegion.children().hide();
        $("<div>").text(label).appendTo(this.liveRegion);
    }
}
Attachments (0)
Change History (1)

Changed March 30, 2019 02:37PM UTC by finexly comment:1

It is so simple, that doesn't even need an example/test.