Skip to content

Commit

Permalink
fix console warning for form elements about readonly target
Browse files Browse the repository at this point in the history
  • Loading branch information
larsrickert committed Jan 20, 2025
1 parent f5946a0 commit 1d673ed
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 24 deletions.
7 changes: 7 additions & 0 deletions .changeset/empty-trees-scream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"sit-onyx": patch
---

fix console warning for form elements about readonly target

The following components were affected: OnyxCheckbox, OnyxCheckboxGroup, OnyxDatePicker, OnyxInput, OnyxRadioButton, OnyxRadioGroup, OnyxSelect, OnyxSelectInput, OnyxStepper, OnyxSwitch and OnyxTextarea
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const title = computed(() => {
return props.hideLabel ? props.label : undefined;
});
const input = useTemplateRef("input");
const input = useTemplateRef("inputRef");
defineExpose({ input });
useAutofocus(input, props);
</script>
Expand All @@ -68,7 +68,7 @@ useAutofocus(input, props);
<OnyxLoadingIndicator v-if="props.loading" class="onyx-checkbox__loading" type="circle" />
<input
v-else
ref="input"
ref="inputRef"
v-model="isChecked"
v-custom-validity
:aria-label="props.hideLabel ? props.label : undefined"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const checkAllLabel = computed(() => {
return props.withCheckAll?.label ?? defaultText;
});
const checkboxes = useTemplateRef("checkboxes");
const checkboxes = useTemplateRef("checkboxesRef");
defineExpose({
inputs: computed<HTMLInputElement[]>(() => {
Expand Down Expand Up @@ -99,7 +99,7 @@ defineExpose({
v-for="option in props.options"
:key="option.value.toString()"
v-bind="option"
ref="checkboxes"
ref="checkboxesRef"
:truncation="option.truncation ?? props.truncation"
:model-value="props.modelValue.includes(option.value)"
class="onyx-checkbox-group__option"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const value = computed({
emit("update:modelValue", isValidDate(newDate) ? newDate.toISOString() : undefined);
},
});
const input = useTemplateRef("input");
const input = useTemplateRef("inputRef");
useAutofocus(input, props);
</script>

Expand Down Expand Up @@ -102,7 +102,7 @@ useAutofocus(input, props);
<input
:id="inputId"
:key="props.type"
ref="input"
ref="inputRef"
v-model="value"
v-custom-validity
class="onyx-datepicker__native"
Expand Down
4 changes: 2 additions & 2 deletions packages/sit-onyx/src/components/OnyxInput/OnyxInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const patternSource = computed(() => {
return props.pattern;
});
const input = useTemplateRef("input");
const input = useTemplateRef("inputRef");
defineExpose({ input });
const { disabled, showError } = useFormContext(props);
Expand Down Expand Up @@ -97,7 +97,7 @@ useAutofocus(input, props);
<OnyxLoadingIndicator v-if="props.loading" class="onyx-input__loading" type="circle" />
<input
:id="inputId"
ref="input"
ref="inputRef"
v-model="modelValue"
v-custom-validity
:placeholder="props.placeholder"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const { densityClass } = useDensity(props);
const { disabled } = useFormContext(props);
const skeleton = useSkeletonContext(props);
const input = useTemplateRef("input");
const input = useTemplateRef("inputRef");
defineExpose({ input });
useAutofocus(input, props);
</script>
Expand All @@ -49,7 +49,7 @@ useAutofocus(input, props);
<!-- TODO: accessible error: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-errormessage -->
<input
v-else
ref="input"
ref="inputRef"
v-custom-validity
class="onyx-radio-button__selector"
type="radio"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const handleChange = (selected: boolean, value: TValue) => {
emit("update:modelValue", value);
};
const radiobuttons = useTemplateRef("radiobuttons");
const radiobuttons = useTemplateRef("radiobuttonsRef");
defineExpose({
inputs: computed<HTMLInputElement[]>(() => {
Expand Down Expand Up @@ -70,7 +70,7 @@ defineExpose({
v-for="(option, index) in props.options"
:key="option.value.toString()"
v-bind="option"
ref="radiobuttons"
ref="radiobuttonsRef"
:name="props.name"
:custom-error="props.customError"
:checked="option.value === props.modelValue"
Expand Down
8 changes: 4 additions & 4 deletions packages/sit-onyx/src/components/OnyxSelect/OnyxSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ const selectionLabels = computed(() => {
}, []);
});
const miniSearch = useTemplateRef("miniSearch");
const selectInput = useTemplateRef("selectInput");
const miniSearch = useTemplateRef("miniSearchRef");
const selectInput = useTemplateRef("selectInputRef");
const filteredOptions = computed(() => {
// if onyx does not manage the search, we don't filter the options further
Expand Down Expand Up @@ -334,7 +334,7 @@ defineExpose({ input: computed(() => selectInput.value?.input) });
<template>
<div ref="selectRef" class="onyx-component onyx-select-wrapper">
<OnyxSelectInput
ref="selectInput"
ref="selectInputRef"
v-bind="selectInputProps"
:show-focus="open"
:autofocus="props.autofocus"
Expand All @@ -356,7 +356,7 @@ defineExpose({ input: computed(() => selectInput.value?.input) });
<!-- model-value is set here, as it is written by the onAutocomplete callback -->
<OnyxMiniSearch
v-if="props.withSearch"
ref="miniSearch"
ref="miniSearchRef"
:model-value="searchTerm"
v-bind="input"
:label="t('select.searchInputLabel')"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const wasTouched = ref(false);
const { densityClass } = useDensity(props);
const input = useTemplateRef("input");
const input = useTemplateRef("inputRef");
defineExpose({ input });
/**
Expand Down Expand Up @@ -158,7 +158,7 @@ useAutofocus(input, props);

<input
:id="inputId"
ref="input"
ref="inputRef"
v-custom-validity
:class="{
'onyx-select-input__native': true,
Expand Down
4 changes: 2 additions & 2 deletions packages/sit-onyx/src/components/OnyxStepper/OnyxStepper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const emit = defineEmits<{
}>();
const { t } = injectI18n();
const input = useTemplateRef("input");
const input = useTemplateRef("inputRef");
const { disabled, showError } = useFormContext(props);
const skeleton = useSkeletonContext(props);
Expand Down Expand Up @@ -127,7 +127,7 @@ useAutofocus(input, props);
<OnyxLoadingIndicator v-if="props.loading" class="onyx-stepper__loading" type="circle" />
<input
v-else
ref="input"
ref="inputRef"
v-model="inputValue"
v-custom-validity
class="onyx-stepper__native"
Expand Down
4 changes: 2 additions & 2 deletions packages/sit-onyx/src/components/OnyxSwitch/OnyxSwitch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const isChecked = computed({
},
});
const input = useTemplateRef("input");
const input = useTemplateRef("inputRef");
defineExpose({ input });
useAutofocus(input, props);
</script>
Expand All @@ -70,7 +70,7 @@ useAutofocus(input, props);
:title="title"
>
<input
ref="input"
ref="inputRef"
v-model="isChecked"
v-custom-validity
type="checkbox"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const { disabled, showError } = useFormContext(props);
const skeleton = useSkeletonContext(props);
const errorClass = useErrorClass(showError);
const input = useTemplateRef("input");
const input = useTemplateRef("inputRef");
defineExpose({ input });
useAutofocus(input, props);
</script>
Expand Down Expand Up @@ -94,7 +94,7 @@ useAutofocus(input, props);
<div class="onyx-textarea__wrapper" :data-autosize-value="modelValue">
<textarea
:id="id"
ref="input"
ref="inputRef"
v-model="modelValue"
v-custom-validity
class="onyx-textarea__native"
Expand Down

0 comments on commit 1d673ed

Please sign in to comment.