Skip to content

Commit e77029f

Browse files
fix(web): make narrow notice details accessible
1 parent a4e3b2b commit e77029f

2 files changed

Lines changed: 22 additions & 15 deletions

File tree

‎apps/web/src/components/chat/ComposerBanner.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ function Actions({ className, ...props }: ComponentProps<"span">) {
246246
data-slot="composer-banner-actions"
247247
className={cn(
248248
"col-start-3 row-start-1 flex flex-wrap items-center justify-end gap-1",
249-
"@max-[400px]:has-[>:nth-child(2)]:col-start-2 @max-[400px]:has-[>:nth-child(2)]:col-end-4 @max-[400px]:has-[>:nth-child(2)]:row-start-2 @max-[400px]:has-[>:nth-child(2)]:-ms-2 @max-[400px]:has-[>:nth-child(2)]:justify-start",
249+
"@max-[400px]:group-data-[composer-banner-layout=wrap-actions]/banner-row:has-[>:nth-child(2)]:col-start-2 @max-[400px]:group-data-[composer-banner-layout=wrap-actions]/banner-row:has-[>:nth-child(2)]:col-end-4 @max-[400px]:group-data-[composer-banner-layout=wrap-actions]/banner-row:has-[>:nth-child(2)]:row-start-2 @max-[400px]:group-data-[composer-banner-layout=wrap-actions]/banner-row:has-[>:nth-child(2)]:-ms-2 @max-[400px]:group-data-[composer-banner-layout=wrap-actions]/banner-row:has-[>:nth-child(2)]:justify-start",
250250
className,
251251
)}
252252
{...props}

‎apps/web/src/components/chat/ComposerBannerStack.tsx‎

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { InfoIcon } from "lucide-react";
22
import { useEffect, useId, useLayoutEffect, useRef, useState, type ReactNode } from "react";
33

44
import { cn } from "~/lib/utils";
5-
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
5+
import { Button } from "../ui/button";
6+
import { Popover, PopoverPopup, PopoverTrigger } from "../ui/popover";
67
import { ComposerBanner, type ComposerBannerVariant } from "./ComposerBanner";
78

89
// Match the duration-220 exit transition before removing a dismissed notice.
@@ -283,25 +284,31 @@ function ComposerBannerStackAlert({
283284
</span>
284285
{item.description ? (
285286
<>
286-
<span className="min-w-0 shrink-[9999] truncate text-muted-foreground @max-[400px]:hidden">
287+
<span className="min-w-0 shrink-[9999] truncate text-muted-foreground @max-[400px]:sr-only">
287288
{item.description}
288289
</span>
289-
<Tooltip>
290-
<TooltipTrigger
290+
<Popover>
291+
<PopoverTrigger
292+
openOnHover
291293
render={
292-
<button
293-
type="button"
294+
<Button
295+
size="icon-xs"
296+
variant="ghost"
294297
aria-label="Show notice details"
295-
className="hidden size-6 flex-none items-center justify-center rounded-md text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring @max-[400px]:inline-flex"
296-
>
297-
<InfoIcon className="size-3.5" />
298-
</button>
298+
className="hidden flex-none text-muted-foreground hover:text-foreground @max-[400px]:inline-flex"
299+
/>
299300
}
300-
/>
301-
<TooltipPopup side="top" className="max-w-72 whitespace-normal text-pretty">
301+
>
302+
<InfoIcon className="size-3.5" />
303+
</PopoverTrigger>
304+
<PopoverPopup
305+
tooltipStyle
306+
side="top"
307+
className="max-w-72 whitespace-normal text-pretty"
308+
>
302309
{item.description}
303-
</TooltipPopup>
304-
</Tooltip>
310+
</PopoverPopup>
311+
</Popover>
305312
</>
306313
) : null}
307314
</ComposerBanner.Content>

0 commit comments

Comments
 (0)