Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: replace Comment div with DrawerDescription component and add aria-describedby for accessibility #208

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { DrawerDescription } from '@liam-hq/ui'
import type { FC } from 'react'
import styles from './Comment.module.css'

Expand All @@ -7,8 +8,8 @@ type Props = {

export const Comment: FC<Props> = ({ comment }) => {
return (
<div className={styles.wrapper}>
<DrawerDescription className={styles.wrapper}>
<p className={styles.text}>{comment}</p>
</div>
</DrawerDescription>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,19 @@ export const TableDetailDrawer: FC = () => {
active: { tableName },
} = useUserEditingStore()
const table = tables[tableName ?? '']
const ariaDescribedBy =
table?.comment == null
? {
'aria-describedby': undefined,
}
: {}

return (
<DrawerPortal>
<DrawerContent
style={{ '--drawer-animation-duration': `${ANIMATION_DURATION}ms` }}
className={styles.content}
{...ariaDescribedBy}
>
{table !== undefined && <TableDetail table={table} />}
</DrawerContent>
Expand Down
2 changes: 2 additions & 0 deletions frontend/packages/ui/src/components/Drawer/Drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ DrawerContent.displayName = Drawer.Content.displayName

export const DrawerTitle = Drawer.Title

export const DrawerDescription = Drawer.Description

export const DrawerClose = Drawer.Close
Loading