Skip to content

Commit

Permalink
fix: label props conditionals
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed Sep 10, 2024
1 parent 7939937 commit c680f7f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/lucky-parents-talk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@formwerk/core': patch
---

fix: labels and descriptions aria are applied when their elements/values exist
2 changes: 1 addition & 1 deletion packages/core/src/a11y/useLabel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function useLabel(props: LabelProps) {
const labelledByProps = computed<AriaLabelableProps>(() => {
if (labelRef.value && toValue(props.label) && toValue(props.targetRef)) {
return {
'aria-labelledby': labelProps.value.id,
'aria-labelledby': toValue(props.label) && labelRef.value ? labelProps.value.id : undefined,
};
}

Expand Down

0 comments on commit c680f7f

Please sign in to comment.