@jsenv/navi 0.29.381 → 0.29.382

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -39822,6 +39822,11 @@ const uiStateHoldsNothing = (uiState) => {
39822
39822
  */
39823
39823
  const NO_ACTION_YET = Symbol("no_action_yet");
39824
39824
 
39825
+ // The control types rendered as an element `<label for>` can name: HTML's
39826
+ // labelable elements are button, input, select, textarea, output, meter and
39827
+ // progress — a picker's trigger is one of them, a link or a details is not.
39828
+ const CONTROL_TYPES_A_LABEL_CAN_POINT_AT = new Set(["button", "input", "select", "picker"]);
39829
+
39825
39830
  // Resets field-specific contexts so nested fields inside this component
39826
39831
  // don't inherit the current field's id, message props, or interface reporting.
39827
39832
  // Sets ParentUIStateControllerContext to the leaf's own uiStateController so
@@ -39918,8 +39923,13 @@ const useControlProps = (props, {
39918
39923
  standalone
39919
39924
  } = props;
39920
39925
  const idDefault = useId();
39921
- const controlId = useContext(ControlIdContext);
39922
- props.id = props.id || controlId || idDefault;
39926
+ // A Field's id is what its Label points at, so only a control a label can
39927
+ // point at (see the set) takes it. A link in the label's own text is a
39928
+ // control too, but never that target: taking the id would make two elements
39929
+ // answer for it, and the label would read the link's state as its control's.
39930
+ const fieldId = useContext(ControlIdContext);
39931
+ const labelable = CONTROL_TYPES_A_LABEL_CAN_POINT_AT.has(controlType);
39932
+ props.id = props.id || (labelable ? fieldId : undefined) || idDefault;
39923
39933
  const controlName = useContext(ControlNameContext);
39924
39934
  props.name = props.name || controlName;
39925
39935
  const isCheckable = isCheckableInput(controlType, props.type);