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

Function commit

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

Source from the content-addressed store, hash-verified

561 };
562
563 let commit = () => {
564 if (triggerState.isOpen && selectionManager.focusedKey != null) {
565 // Reset inputValue and close menu here if the selected key is already the focused key. Otherwise
566 // fire onSelectionChange to allow the application to control the closing.
567 if (selectionManager.isSelected(selectionManager.focusedKey) && selectionMode === 'single') {
568 commitSelection(true);
569 } else {
570 selectionManager.select(selectionManager.focusedKey);
571 }
572 } else {
573 commitValue();
574 }
575 };
576
577 let valueOnFocus = useRef([inputValue, displayValue]);
578 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