fabiomcosta / mootools-meio-autocomplete

A complete mootools Autocomplete plugin
http://www.meiocodigo.com/projects/meio-autocomplete/
32 stars 14 forks source link

Keyboard events bubble up #4

Open trobrock opened 13 years ago

trobrock commented 13 years ago

When I put this plugin on a field inside of a table generated with htmltable.select the keyboard shortcut to navigate items bubbles up to the htmltable.select class and changes table rows

fabiomcosta commented 12 years ago

Sorry for taking so long to respond, I feel bad about it. I didn't understand the problem you are having, can you explain it better?

RiZKiT commented 11 years ago

I quickly investigated the problem and i see what he means. With HtmlTable.Select (http://mootools.net/docs/more/Interface/HtmlTable.Select) you can navigate/change the focus inside a table with cursor keys. When you have an autocomplete field in that table and you navigate in the autocomplete suggestions with cursor keys, you change the focus in the table, too. Its because the event bubbles up to the table.

To prevent that, you can do something like (element is the input element with autocomplete):

element.addEvent('keydown', function(event){ event.stopPropagation(); });

I'm in doubt that this should be changed inside the plugin, because its a very special case.