MCPcopy Index your code
hub / github.com/codeaashu/claude-code / handleNavigation

Function handleNavigation

src/components/mcp/ElicitationDialog.tsx:289–327  ·  view source on GitHub ↗
(direction: 'up' | 'down')

Source from the content-addressed store, hash-verified

287 }
288 }
289 function handleNavigation(direction: 'up' | 'down'): void {
290 // Collapse accordion and validate on navigate away
291 if (currentField && isMultiSelectEnumSchema(currentField.schema)) {
292 validateMultiSelect(currentField.name, currentField.schema);
293 setExpandedAccordion(undefined);
294 } else if (currentField && isEnumSchema(currentField.schema)) {
295 setExpandedAccordion(undefined);
296 }
297
298 // Commit current text field before navigating away
299 if (isEditingTextField && currentField) {
300 commitTextField(currentField.name, currentField.schema, textInputValue);
301
302 // Cancel any pending debounce — we're resolving now on navigate-away
303 if (dateDebounceRef.current !== undefined) {
304 clearTimeout(dateDebounceRef.current);
305 dateDebounceRef.current = undefined;
306 }
307
308 // For date/datetime fields that failed sync validation, try async NL parsing
309 if (isDateTimeSchema(currentField.schema) && textInputValue.trim() !== '' && validationErrors[currentField.name]) {
310 resolveFieldAsync(currentField.name, currentField.schema, textInputValue);
311 }
312 }
313
314 // Fields + accept + decline
315 const itemCount = schemaFields.length + 2;
316 const index = currentFieldIndex ?? (focusedButton === 'accept' ? schemaFields.length : focusedButton === 'decline' ? schemaFields.length + 1 : undefined);
317 const nextIndex = index !== undefined ? (index + (direction === 'up' ? itemCount - 1 : 1)) % itemCount : 0;
318 if (nextIndex < schemaFields.length) {
319 setCurrentFieldIndex(nextIndex);
320 setFocusedButton(null);
321 syncTextInput(nextIndex);
322 } else {
323 setCurrentFieldIndex(undefined);
324 setFocusedButton(nextIndex === schemaFields.length ? 'accept' : 'decline');
325 setTextInputValue('');
326 }
327 }
328 function setField(fieldName_0: string, value: number | string | boolean | string[] | undefined) {
329 setFormValues(prev => {
330 const next = {

Callers 2

handleTextInputSubmitFunction · 0.85
ElicitationFormDialogFunction · 0.85

Calls 6

isMultiSelectEnumSchemaFunction · 0.85
validateMultiSelectFunction · 0.85
isEnumSchemaFunction · 0.85
commitTextFieldFunction · 0.85
isDateTimeSchemaFunction · 0.85
resolveFieldAsyncFunction · 0.85

Tested by

no test coverage detected