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

Function commitValue

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

Source from the content-addressed store, hash-verified

569 };
570
571 const commitValue = () => {
572 closedDueToEmpty.current = false;
573 if (allowsCustomValue) {
574 const itemText =
575 selectedKey != null ? (collection.getItem(selectedKey)?.textValue ?? '') : '';
576 inputValue === itemText ? commitSelection() : commitCustomValue();
577 } else {
578 // Reset inputValue and close menu
579 commitSelection();
580 }
581 };
582
583 let commit = () => {
584 if (triggerState.isOpen && selectionManager.focusedKey != null) {

Callers 2

commitFunction · 0.70
setFocusedFunction · 0.70

Calls 3

commitCustomValueFunction · 0.85
commitSelectionFunction · 0.70
getItemMethod · 0.65

Tested by

no test coverage detected