Opened 8 years ago

Closed 8 years ago

#7070 closed bug (fixed)

event.originalEvent undefined in overridden focus event

Reported by: JackT Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.autocomplete Version: 1.8.5
Keywords: Cc:
Blocked by: Blocking:

Description

I need to override the autocomplete focus event with a custom action and do something based on whether the user was selecting from the list using the keyboard and not the mouse. To do that I'm checking the originalEvent.type in the event object which is supposed to contain the type of action performed (keydown, keyup, mouseenter, etc).

However, the originalEvent object seems to be undefined. It is working just fine in the actual focus event in the autocomplete code, but not when I override that event inside of the autocomplete object.

Please see my code below.

$( "#tags" ).autocomplete({
    source: availableTags,
    focus: function(event, ui) {
        //Check whether focus was triggered by a mouse or keyboard event
        if ( /^key/.test(event.originalEvent.type) ) {
            //Do something here
        }                   

        return false;
    }
});

Change History (1)

comment:1 Changed 8 years ago by Scott González

Resolution: fixed
Status: newclosed

This was already fixed. In the future please test against the latest version before filing a bug.

Note: See TracTickets for help on using tickets.