Skip to content

Commit 127efae

Browse files
fix(web): expose error disclosure state (pingdotgg#10125)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 00d6109 commit 127efae

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎apps/web/src/components/settings/ExpandableText.tsx‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useState } from "react";
1+
import { useId, useState } from "react";
22

33
import { cn } from "../../lib/utils";
44

@@ -17,12 +17,14 @@ export function ExpandableText({
1717
collapsedClassName?: string;
1818
expandLabel?: string;
1919
}) {
20+
const textId = useId();
2021
const [expanded, setExpanded] = useState(false);
2122
const canExpand = text.length > 180 || text.includes("\n");
2223

2324
return (
2425
<div className={cn("min-w-0", className)}>
2526
<div
27+
id={textId}
2628
className={cn(
2729
"whitespace-pre-wrap break-words",
2830
!expanded && canExpand ? collapsedClassName : null,
@@ -33,6 +35,8 @@ export function ExpandableText({
3335
{canExpand ? (
3436
<button
3537
type="button"
38+
aria-expanded={expanded}
39+
aria-controls={textId}
3640
className="cursor-pointer mt-1 text-[11px] font-medium text-foreground/70 underline-offset-2 hover:text-foreground hover:underline"
3741
onClick={() => setExpanded((value) => !value)}
3842
>

0 commit comments

Comments
 (0)