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

Function commitValue

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

Source from the content-addressed store, hash-verified

550 };
551
552 const commitValue = () => {
553 if (allowsCustomValue) {
554 const itemText =
555 selectedKey != null ? (collection.getItem(selectedKey)?.textValue ?? '') : '';
556 inputValue === itemText ? commitSelection() : commitCustomValue();
557 } else {
558 // Reset inputValue and close menu
559 commitSelection();
560 }
561 };
562
563 let commit = () => {
564 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