Ticket #7070 (closed bug: fixed)

Opened 2 years ago

Last modified 2 years ago

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:
Blocking: Blocked by:

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

comment:1 Changed 2 years ago by scott.gonzalez

  • Status changed from new to closed
  • Resolution set to fixed

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.