| 1134 | } |
| 1135 | |
| 1136 | const typeKey = (model: MenuModel, $: MenuUpdate, key: string) => { |
| 1137 | const items = visibleOf($.props) |
| 1138 | const from = model.active === null |
| 1139 | ? -1 |
| 1140 | : items.findIndex((item) => item.value === model.active) |
| 1141 | // Omit disabled flags to include disabled matches. |
| 1142 | const { index, state } = Typeahead.step( |
| 1143 | model.typeahead, |
| 1144 | key, |
| 1145 | items.map(({ label }) => ({ label })), |
| 1146 | from |
| 1147 | ) |
| 1148 | const item = items[index] |
| 1149 | const moved = item === undefined |
| 1150 | ? {} |
| 1151 | : { active: item.value, activeByKey: true } |
| 1152 | return commit( |
| 1153 | $, |
| 1154 | model, |
| 1155 | UiStruct.evolve(model, { typeahead: state, ...moved }), |
| 1156 | "keyboard" |
| 1157 | ).run( |
| 1158 | Typeahead.waitReset(MenuMessage.CompletedWaitBeforeResetTyping, 500) |
| 1159 | ) |
| 1160 | } |
| 1161 | |
| 1162 | const keys = (orientation: ListNavigation.Orientation, rtl: boolean) => { |
| 1163 | const cross = ListNavigation.arrowKeys( |