Skip to content

Commit

Permalink
feat(WCAG): Adds aria-describedby to PTE
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrobonamin committed Sep 8, 2023
1 parent 39b2979 commit f99b502
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/@sanity/portable-text-editor/src/editor/Editable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export type PortableTextEditableProps = {
scrollSelectionIntoView?: ScrollSelectionIntoViewFunction
selection?: EditorSelection
spellCheck?: boolean
describedBy: string | undefined
}

/**
Expand All @@ -91,6 +92,7 @@ export const PortableTextEditable = forwardRef(function PortableTextEditable(
selection: propsSelection,
scrollSelectionIntoView,
spellCheck,
describedBy,
...restProps
} = props

Expand Down Expand Up @@ -405,6 +407,7 @@ export const PortableTextEditable = forwardRef(function PortableTextEditable(
renderLeaf={renderLeaf}
style={props.style}
scrollSelectionIntoView={scrollSelectionIntoViewToSlate}
aria-describedby={describedBy}
/>
),
[
Expand All @@ -420,6 +423,7 @@ export const PortableTextEditable = forwardRef(function PortableTextEditable(
renderElement,
renderLeaf,
scrollSelectionIntoViewToSlate,
describedBy,
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export function Editor(props: EditorProps) {
selection={initialSelection}
style={noOutlineStyle}
spellCheck={spellcheck}
aria-describedby={describedBy}
describedBy={describedBy}
/>
),
[
Expand Down

0 comments on commit f99b502

Please sign in to comment.