| CODENOTIFIER | HelpYou are not signed inSign in |
Project: Google Web Toolkit
Revision: 3619
Author: jlabanca@google.com
Date: 04 Sep 2008 16:20:00
Changes:MenuBar focuses itself when a MenuItem is selected for any reason so the user can seamlessly switch between the mouse and keyboard. However, this means that the SuggestBox loses focus as soon as the first suggestion is automatically highlighted. This patch makes the focus optional in MenuBar.
Patch by: jlabanca
Review by: ajr
| ... | ...@@ -329,14 +329,14 @@ | |
| 329 | 329 | |
| 330 | 330 | case Event.ONMOUSEOVER: { |
| 331 | 331 | if (item != null) { |
| 332 | itemOver(item); | |
| 332 | itemOver(item, true); | |
| 333 | 333 | } |
| 334 | 334 | break; |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | case Event.ONMOUSEOUT: { |
| 338 | 338 | if (item != null) { |
| 339 | itemOver(null); | |
| 339 | itemOver(null, true); | |
| 340 | 340 | } |
| 341 | 341 | break; |
| 342 | 342 | } |
| ... | ...@@ -555,7 +555,7 @@ | |
| 555 | 555 | } |
| 556 | 556 | } |
| 557 | 557 | |
| 558 | void itemOver(MenuItem item) { | |
| 558 | void itemOver(MenuItem item, boolean focus) { | |
| 559 | 559 | if (item == null) { |
| 560 | 560 | // Don't clear selection if the currently selected item's menu is showing. |
| 561 | 561 | if ((selectedItem != null) |
| ... | ...@@ -566,7 +566,9 @@ | |
| 566 | 566 | |
| 567 | 567 | // Style the item selected when the mouse enters. |
| 568 | 568 | selectItem(item); |
| 569 | focus(); | |
| 569 | if (focus) { | |
| 570 | focus(); | |
| 571 | } | |
| 570 | 572 | |
| 571 | 573 | // If child menus are being shown, or this menu is itself |
| 572 | 574 | // a child menu, automatically show an item's child menu |
| ... | ...@@ -173,7 +173,7 @@ | |
| 173 | 173 | public void selectItem(int index) { |
| 174 | 174 | List<MenuItem> items = getItems(); |
| 175 | 175 | if (index > -1 && index < items.size()) { |
| 176 | itemOver(items.get(index)); | |
| 176 | itemOver(items.get(index), false); | |
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | } |
| ... | ...@@ -114,7 +114,7 @@ | |
| 114 | 114 | RootPanel.get().add(bar); |
| 115 | 115 | |
| 116 | 116 | // Open the item with a submenu |
| 117 | bar.itemOver(top2); | |
| 117 | bar.itemOver(top2, true); | |
| 118 | 118 | |
| 119 | 119 | // Set the Debug Id |
| 120 | 120 | bar.ensureDebugId("myMenu"); |