fix(website): accessibility

This commit is contained in:
iCrawl
2022-08-12 17:03:04 +02:00
parent c97977a3e8
commit 2447165c82
4 changed files with 17 additions and 7 deletions

View File

@@ -13,14 +13,14 @@ export interface RemarksBlockProps {
} }
export function CommentSection({ node, textClassName }: RemarksBlockProps): JSX.Element { export function CommentSection({ node, textClassName }: RemarksBlockProps): JSX.Element {
const createNode = (node: ReturnType<CommentNode['toJSON']>): ReactNode => { const createNode = (node: ReturnType<CommentNode['toJSON']>, idx?: number): ReactNode => {
switch (node.kind) { switch (node.kind) {
case 'PlainText': case 'PlainText':
return <span>{(node as ReturnType<PlainTextCommentNode['toJSON']>).text}</span>; return <span>{(node as ReturnType<PlainTextCommentNode['toJSON']>).text}</span>;
case 'Paragraph': case 'Paragraph':
return ( return (
<p className={textClassName}> <p key={idx} className={textClassName}>
{(node as ReturnType<CommentNodeContainer['toJSON']>).nodes.map((node) => createNode(node))} {(node as ReturnType<CommentNodeContainer['toJSON']>).nodes.map((node, idx) => createNode(node, idx))}
</p> </p>
); );
case 'SoftBreak': case 'SoftBreak':
@@ -52,7 +52,7 @@ export function CommentSection({ node, textClassName }: RemarksBlockProps): JSX.
return ( return (
<div> <div>
{node.kind === 'Paragraph' || node.kind === 'Section' ? ( {node.kind === 'Paragraph' || node.kind === 'Section' ? (
<>{(node as CommentNodeContainer).nodes.map(createNode)}</> <>{(node as CommentNodeContainer).nodes.map((node, idx) => createNode(node, idx))}</>
) : ( ) : (
<>{createNode(node)}</> <>{createNode(node)}</>
)} )}

View File

@@ -25,7 +25,12 @@ export function ItemSidebar({ packageName, data, selectedMember }: ItemListProps
<VscPackage /> <VscPackage />
{`${packageName}`} {`${packageName}`}
</h2> </h2>
<button className="lg:hidden mr-2 bg-transparent border-none cursor-pointer" onClick={onMenuClick}> <button
type="button"
className="lg:hidden mr-2 bg-transparent border-none cursor-pointer"
title="Menu"
onClick={onMenuClick}
>
<FiMenu size={32} /> <FiMenu size={32} />
</button> </button>
</div> </div>

View File

@@ -30,7 +30,12 @@ export function MethodItem({ data }: MethodItemProps) {
return ( return (
<div className="flex flex-col"> <div className="flex flex-col">
<div className="flex"> <div className="flex">
<button className="bg-transparent border-none cursor-pointer dark:text-white" onClick={onAnchorClick}> <button
type="button"
className="bg-transparent border-none cursor-pointer dark:text-white"
title="Anchor"
onClick={onAnchorClick}
>
<FiLink size={16} /> <FiLink size={16} />
</button> </button>
<div className="flex flex-col"> <div className="flex flex-col">

View File

@@ -58,7 +58,7 @@ export default function IndexRoute() {
</div> </div>
</div> </div>
<div className="flex place-content-center"> <div className="flex place-content-center">
<a href="https://vercel.com/?utm_source=discordjs&utm_campaign=oss"> <a href="https://vercel.com/?utm_source=discordjs&utm_campaign=oss" title="Vercel">
<Image <Image
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
src={vercelLogo} src={vercelLogo}