MCPcopy Create free account
hub / github.com/adobe/react-spectrum / commit

Function commit

packages/react-stately/src/combobox/useComboBoxState.ts:583–595  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

581 };
582
583 let commit = () => {
584 if (triggerState.isOpen && selectionManager.focusedKey != null) {
585 // Reset inputValue and close menu here if the selected key is already the focused key. Otherwise
586 // fire onSelectionChange to allow the application to control the closing.
587 if (selectionManager.isSelected(selectionManager.focusedKey) && selectionMode === 'single') {
588 commitSelection(true);
589 } else {
590 selectionManager.select(selectionManager.focusedKey);
591 }
592 } else {
593 commitValue();
594 }
595 };
596
597 let valueOnFocus = useRef([inputValue, displayValue]);
598 let setFocused = (isFocused: boolean) => {

Callers

nothing calls this directly

Calls 4

commitSelectionFunction · 0.70
commitValueFunction · 0.70
isSelectedMethod · 0.65
selectMethod · 0.65

Tested by

no test coverage detected