protected override void KeyDownHandler(Event e) { if (!Enabled) { return; } KeyboardEvent ke = (KeyboardEvent)e; if (!DropDownController.ProcessKeyDown(e)) { var navigationKey = ke.KeyCode; var navigationUnit = NavigationUnitUtil.GetNavigationUnit(navigationKey); /*if (findKey(ke.charCode)) * { * event.preventDefault(); * return; * }*/ if (!NavigationUnitUtil.IsNavigationUnit(navigationKey)) { return; } var proposedNewIndex = NO_SELECTION; int currentIndex; if (IsDropDownOpen) { // Normalize the proposed index for getNavigationDestinationIndex currentIndex = UserProposedSelectedIndex < NO_SELECTION ? NO_SELECTION : UserProposedSelectedIndex; proposedNewIndex = Layout.GetNavigationDestinationIndex(currentIndex, navigationUnit, ArrowKeysWrapFocus); if (proposedNewIndex != NO_SELECTION) { ChangeHighlightedSelection(proposedNewIndex); e.PreventDefault(); } } else if (null != DataProvider) { var maxIndex = DataProvider.Length - 1; // Normalize the proposed index for getNavigationDestinationIndex currentIndex = CaretIndex < NO_SELECTION ? NO_SELECTION : CaretIndex; switch (navigationUnit) { case NavigationUnit.Up: { if (ArrowKeysWrapFocus && (currentIndex == 0 || currentIndex == NO_SELECTION || currentIndex == CUSTOM_SELECTED_ITEM)) { proposedNewIndex = maxIndex; } else { proposedNewIndex = currentIndex - 1; } e.PreventDefault(); break; } case NavigationUnit.Down: { if (ArrowKeysWrapFocus && (currentIndex == maxIndex || currentIndex == NO_SELECTION || currentIndex == CUSTOM_SELECTED_ITEM)) { proposedNewIndex = 0; } else { proposedNewIndex = currentIndex + 1; } e.PreventDefault(); break; } case NavigationUnit.PageUp: { proposedNewIndex = currentIndex == NO_SELECTION ? NO_SELECTION : Math.Max(currentIndex - PAGE_SIZE, 0); e.PreventDefault(); break; } case NavigationUnit.PageDown: { proposedNewIndex = currentIndex == NO_SELECTION ? PAGE_SIZE : (currentIndex + PAGE_SIZE); e.PreventDefault(); break; } case NavigationUnit.Home: { proposedNewIndex = 0; e.PreventDefault(); break; } case NavigationUnit.End: { proposedNewIndex = maxIndex; e.PreventDefault(); break; } } proposedNewIndex = Math.Min(proposedNewIndex, maxIndex); if (proposedNewIndex >= 0) { SetSelectedIndex(proposedNewIndex, true); } } } else { e.PreventDefault(); } }