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

Function commit

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

Source from the content-addressed store, hash-verified

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