Skip to content

Commit

Permalink
fix(FormGroup): remove inputId if the input is a fieldset (#914)
Browse files Browse the repository at this point in the history
  • Loading branch information
romhml committed Nov 3, 2023
1 parent 7891ccb commit e81d5cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/runtime/components/forms/RadioGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default defineComponent({
const { ui, attrs } = useUI('radioGroup', toRef(props, 'ui'), config, toRef(props, 'class'))
const { ui: uiRadio } = useUI('radio', toRef(props, 'uiRadio'), configRadio)
const { emitFormChange, color, name } = useFormGroup(props, config)
const { emitFormChange, color, name } = useFormGroup({ ...props, isFieldset: true }, config)
provide('radio-group', { color, name })
const onUpdate = (value: any) => {
Expand Down
5 changes: 3 additions & 2 deletions src/runtime/composables/useFormGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import { type UseEventBusReturn, useDebounceFn } from '@vueuse/core'
import type { FormEvent, FormEventType, InjectedFormGroupValue } from '../types/form'

type InputProps = {
id?: string
id?: string | null
size?: string | number | symbol
color?: string
name?: string
isFieldset?: boolean
}

export const useFormGroup = (inputProps?: InputProps, config?: any) => {
Expand All @@ -17,7 +18,7 @@ export const useFormGroup = (inputProps?: InputProps, config?: any) => {
const inputId = ref(inputProps?.id)

onMounted(() => {
inputId.value = inputProps?.id ?? formGroup?.inputId.value
inputId.value = inputProps?.isFieldset ? null : inputProps?.id ?? formGroup?.inputId.value
if (formGroup) {
// Updates for="..." attribute on label if inputProps.id is provided
formGroup.inputId.value = inputId.value
Expand Down

1 comment on commit e81d5cf

@vercel
Copy link

@vercel vercel bot commented on e81d5cf Nov 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

ui – ./

ui-git-dev-nuxt-js.vercel.app
ui.nuxt.com
ui-nuxt-js.vercel.app

Please sign in to comment.