我遇到問題:當我在建議文本框中輸入文本時,會出現彈出窗口。 但是,當用戶將鼠標放置在這個彈出面板上並帶有建議時 - 文本框會失去焦點。當DIV懸停時,文本框會丟失焦點
我應該怎麼做才能防止失去焦點?
例具有相同的行爲:http://demo.raibledesigns.com/gwt-autocomplete/
感謝您的幫助。
更新1
SuggestionMenu
正被示出的延伸MenuBar
其設定焦點的所有菜單項。
void itemOver(MenuItem item, boolean focus) {
if (item == null) {
// Don't clear selection if the currently selected item's menu is showing.
if ((selectedItem != null)
&& (shownChildMenu == selectedItem.getSubMenu())) {
return;
}
}
// Style the item selected when the mouse enters.
selectItem(item);
if (focus) {
focus();
}
// If child menus are being shown, or this menu is itself
// a child menu, automatically show an item's child menu
// when the mouse enters.
if (item != null) {
if ((shownChildMenu != null) || (parentMenu != null) || autoOpen) {
doItemAction(item, false);
}
}
}
很明顯,我不能修復失去焦點。現在的問題是 - 如何在按下退格鍵或任何鍵來關注編輯框?
在此先感謝
我最好的猜測是onmouseover .focus()在列表項上調用...以便鍵盤導航工作... – scunliffe 2010-04-22 14:18:13
您可以不只是在用戶建議選擇焦點後明確地打出電話()再次在文本框中? – Shaunwithanau 2010-04-22 14:57:12