fix(webui): gate focus indicators on keyboard navigation modality (#6734)
This commit is contained in:
1 parent
cb95277098
commit
c6fd1b3ecb
24 files changed
+355
-86
No files matched your search
@@ -1,4 +1,3 @@
|
||||
import { surfaceFocusProps } from "@/lib/surface-focus";
|
||||
import { useContext, useState } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
import { SidebarPanelActionsContext } from "@/components/ui/sidebar-panel";
|
||||
@@ -51,8 +50,7 @@ export function FilePreviewPanelView({ path, state, imageOpen, onImageOpenChange
|
||||
<section aria-label={t("filePreview.aria")} data-testid="file-preview-panel" className="flex min-h-0 flex-1 flex-col">
|
||||
{markdown && (actionsHost ? createPortal(modeControl, actionsHost) : <div className="flex shrink-0 justify-end px-4 py-2">{modeControl}</div>)}
|
||||
<div key={mode} data-file-preview-scroll tabIndex={0}
|
||||
{...surfaceFocusProps}
|
||||
className="min-h-0 flex-1 overflow-auto outline-none data-[keyboard-focus]:ring-2 data-[keyboard-focus]:ring-inset data-[keyboard-focus]:ring-ring/60">
|
||||
className="min-h-0 flex-1 overflow-auto outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/60">
|
||||
{state.status === "loading" ? (
|
||||
<div role="status" aria-label={t("filePreview.loading", { defaultValue: "Loading preview..." })}
|
||||
className="h-full" aria-busy="true">
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { currentLocale, setAppLanguage } from "@/i18n";
|
||||
@@ -8,24 +7,15 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@
|
||||
|
||||
export function LanguageSwitcher({ className }: { className?: string }) {
|
||||
const { t } = useTranslation();
|
||||
const [pointerFocus, setPointerFocus] = useState(false);
|
||||
return (
|
||||
<Select value={currentLocale()} onValueChange={(value) => { void setAppLanguage(value as SupportedLocale); }}>
|
||||
<SelectTrigger
|
||||
className={cn("min-w-40 rounded-full", pointerFocus && "focus-visible:ring-0", className)}
|
||||
className={cn("min-w-40 rounded-full", className)}
|
||||
aria-label={t("sidebar.language.ariaLabel")}
|
||||
onPointerDown={() => setPointerFocus(true)}
|
||||
onKeyDown={() => setPointerFocus(false)}
|
||||
onBlur={() => setPointerFocus(false)}
|
||||
>
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent
|
||||
onPointerUpCapture={() => setPointerFocus(true)}
|
||||
onPointerDownOutside={() => setPointerFocus(true)}
|
||||
onKeyDownCapture={() => setPointerFocus(false)}
|
||||
onEscapeKeyDown={() => setPointerFocus(false)}
|
||||
>
|
||||
<SelectContent>
|
||||
{supportedLocales.map((option) => (
|
||||
<SelectItem
|
||||
key={option.code}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { surfaceFocusProps } from "@/lib/surface-focus";
|
||||
import {
|
||||
Children,
|
||||
isValidElement,
|
||||
@@ -689,7 +688,7 @@ export default function MarkdownTextRenderer({
|
||||
void _node;
|
||||
return (
|
||||
<div
|
||||
data-testid="markdown-data-table" {...surfaceFocusProps}
|
||||
data-testid="markdown-data-table"
|
||||
data-table-kind="data"
|
||||
role="region"
|
||||
tabIndex={0}
|
||||
@@ -697,7 +696,7 @@ export default function MarkdownTextRenderer({
|
||||
className={cn(
|
||||
"not-prose mb-5 mt-3 w-full max-w-full overflow-x-auto rounded-lg",
|
||||
"border border-border/65 bg-muted/20",
|
||||
"overscroll-x-contain outline-none data-[keyboard-focus]:ring-2 data-[keyboard-focus]:ring-ring",
|
||||
"overscroll-x-contain outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
||||
)}
|
||||
>
|
||||
<table
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { surfaceFocusProps } from "@/lib/surface-focus";
|
||||
import { useEffect, useId, useRef, type PointerEvent, type ReactNode, type Ref } from "react";
|
||||
import { SidebarPanel } from "@/components/ui/sidebar-panel";
|
||||
import { PanelRightClose, X } from "lucide-react";
|
||||
@@ -99,8 +98,8 @@ export function PreviewPane({ tabs, activeId, width, isClosing, onSelect, onClos
|
||||
className="file-preview-resize group absolute inset-y-0 left-0 z-20 hidden w-2 cursor-col-resize touch-none justify-start focus-visible:outline-none">
|
||||
<span aria-hidden className="h-full w-px bg-foreground/25 opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100" />
|
||||
</button>
|
||||
<div role="tabpanel" {...surfaceFocusProps} id={`${id}-panel`} aria-labelledby={`${id}-tab-${tabs.findIndex((tab) => tab.id === activeId)}`} tabIndex={0}
|
||||
className="flex min-h-0 flex-1 flex-col outline-none data-[keyboard-focus]:ring-2 data-[keyboard-focus]:ring-inset data-[keyboard-focus]:ring-ring">
|
||||
<div role="tabpanel" id={`${id}-panel`} aria-labelledby={`${id}-tab-${tabs.findIndex((tab) => tab.id === activeId)}`} tabIndex={0}
|
||||
className="flex min-h-0 flex-1 flex-col outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring">
|
||||
{children}
|
||||
</div>
|
||||
</SidebarPanel>;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { modelAPIConfigurable, preferredModelAPI, REQUEST_API_LABELS } from "@/components/settings/models/modelAPI";
|
||||
@@ -6,7 +5,6 @@ import { ToggleButton } from "@/components/ui/toggle-button";
|
||||
import { SettingsRow } from "@/components/settings/shared/SettingsControls";
|
||||
import { SettingsHint } from "@/components/settings/shared/SettingsHint";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import { cn } from "@/lib/utils";
|
||||
import type { ModelAPIConfig, ProviderRequestAPI, SettingsPayload } from "@/lib/types";
|
||||
|
||||
export function ModelAPIControl({
|
||||
@@ -26,7 +24,6 @@ export function ModelAPIControl({
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const controlTitle = title ?? t("settings.models.requestAPI");
|
||||
const [pointerFocus, setPointerFocus] = useState(false);
|
||||
const requestAPIs = Array.isArray(provider?.request_apis) ? provider.request_apis : undefined;
|
||||
const configurable = modelAPIConfigurable(provider);
|
||||
const fixedAPI = requestAPIs?.length === 1 ? requestAPIs[0] : undefined;
|
||||
@@ -69,19 +66,11 @@ export function ModelAPIControl({
|
||||
}}>
|
||||
<SelectTrigger
|
||||
aria-label={controlTitle}
|
||||
className={cn("w-full rounded-full", pointerFocus && "focus-visible:ring-0")}
|
||||
onPointerDown={() => setPointerFocus(true)}
|
||||
onKeyDown={() => setPointerFocus(false)}
|
||||
onBlur={() => setPointerFocus(false)}
|
||||
className="w-full rounded-full"
|
||||
>
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent
|
||||
onPointerUpCapture={() => setPointerFocus(true)}
|
||||
onPointerDownOutside={() => setPointerFocus(true)}
|
||||
onKeyDownCapture={() => setPointerFocus(false)}
|
||||
onEscapeKeyDown={() => setPointerFocus(false)}
|
||||
>
|
||||
<SelectContent>
|
||||
{options.map((option) => (
|
||||
<SelectItem key={option.value} value={option.value}>{option.label}</SelectItem>
|
||||
))}
|
||||
|
||||
@@ -275,7 +275,6 @@ export function ModelsSettings({
|
||||
const tx = (key: string, fallback: string, values?: Record<string, unknown>) =>
|
||||
t(key, { defaultValue: fallback, ...(values ?? {}) });
|
||||
const [editorOpen, setEditorOpen] = useState(false);
|
||||
const [hideEditorReturnFocus, setHideEditorReturnFocus] = useState(false);
|
||||
const [advancedOpen, setAdvancedOpen] = useState(false);
|
||||
const resolvedAutomaticAPI = useAutomaticModelAPI({
|
||||
token,
|
||||
@@ -437,7 +436,6 @@ export function ModelsSettings({
|
||||
preset: SettingsPayload["model_presets"][number],
|
||||
rowKey: string,
|
||||
) => {
|
||||
setHideEditorReturnFocus(false);
|
||||
editorTriggerRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
||||
if (edits.needsCompletion() && !(await edits.commit())) return;
|
||||
if (!creating && selectedPreset?.name === preset.name && activeEditorRowKey === rowKey) {
|
||||
@@ -848,11 +846,9 @@ export function ModelsSettings({
|
||||
aria-label={ordered ? `${name}. ${t("settings.models.dragToReorder")}` : name}
|
||||
data-testid={`model-call-order-row-${name}`}
|
||||
onPointerDown={(event) => {
|
||||
setHideEditorReturnFocus(false);
|
||||
presetDrag.start(event, key);
|
||||
}}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key !== "Escape") setHideEditorReturnFocus(false);
|
||||
if (event.currentTarget !== event.target) return;
|
||||
if (ordered && event.key === "ArrowUp") {
|
||||
event.preventDefault();
|
||||
@@ -871,7 +867,7 @@ export function ModelsSettings({
|
||||
ordered && (callOrderBusy ? "cursor-wait" : "cursor-grab active:cursor-grabbing"),
|
||||
!isDragging && "settings-hover",
|
||||
isSelected && "bg-muted/45",
|
||||
!hideEditorReturnFocus && "focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",
|
||||
"focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",
|
||||
)}
|
||||
>
|
||||
<div className="contents">
|
||||
@@ -881,8 +877,7 @@ export function ModelsSettings({
|
||||
aria-haspopup="dialog"
|
||||
disabled={!preset}
|
||||
onClick={() => preset && selectPreset(preset, key)}
|
||||
className={cn("col-span-2 grid min-w-0 grid-cols-subgrid items-center rounded-control text-left outline-none",
|
||||
!hideEditorReturnFocus && "focus-visible:ring-2 focus-visible:ring-ring")}
|
||||
className="col-span-2 grid min-w-0 grid-cols-subgrid items-center rounded-control text-left outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
||||
>
|
||||
{presetConfigured ? (
|
||||
<span className={cn("relative aspect-square min-w-8", primary ? "w-[calc(var(--preset-title-size)*1.375+1.5rem)]" : "h-8")}>
|
||||
@@ -978,13 +973,10 @@ export function ModelsSettings({
|
||||
type="button"
|
||||
variant="link"
|
||||
size="sm"
|
||||
className={cn("mr-auto h-11 gap-2 text-[13px] font-normal text-muted-foreground hover:font-semibold hover:text-orange-700 hover:no-underline dark:hover:text-orange-400 sm:h-9",
|
||||
hideEditorReturnFocus && "focus-visible:ring-0 focus-visible:ring-offset-0")}
|
||||
onKeyDown={(event) => { if (event.key !== "Escape") setHideEditorReturnFocus(false); }}
|
||||
className="mr-auto h-11 gap-2 text-[13px] font-normal text-muted-foreground hover:font-semibold hover:text-orange-700 hover:no-underline dark:hover:text-orange-400 sm:h-9"
|
||||
disabled={callOrderBusy}
|
||||
onClick={(event) => {
|
||||
editorTriggerRef.current = event.currentTarget;
|
||||
setHideEditorReturnFocus(false);
|
||||
setEditorRowKey(null);
|
||||
setEditorOpen(true);
|
||||
onBeginCreate();
|
||||
@@ -1011,7 +1003,6 @@ export function ModelsSettings({
|
||||
<DialogContent aria-describedby={undefined}
|
||||
onChangeCapture={edits.onChangeCapture} onFocusCapture={edits.onFocusCapture}
|
||||
onBlurCapture={edits.onBlurCapture}
|
||||
onEscapeKeyDown={() => setHideEditorReturnFocus(true)}
|
||||
className="relative max-h-[85dvh] w-[min(calc(100vw-2rem),40rem)] max-w-none gap-0 overflow-y-auto p-0"
|
||||
onOpenAutoFocus={(event) => {
|
||||
if (!focusImageInput.current || !imageInputRef.current) return;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
.appearance-theme-option { position: relative; min-width: 0; cursor: pointer; }
|
||||
.appearance-theme-input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
|
||||
.appearance-theme-card { --appearance-theme-inset: 8px; display: block; padding: var(--appearance-theme-inset); border: 1px solid hsl(var(--border)); border-radius: var(--radius-panel); background: hsl(var(--settings-surface)); transition: border-color 160ms ease; }
|
||||
.appearance-theme-option input:focus-visible + .appearance-theme-card { outline: 2px solid hsl(var(--ring) / 0.65); outline-offset: 3px; }
|
||||
:where(:root:not([data-focus-modality="pointer"])) .appearance-theme-option input:focus-visible + .appearance-theme-card { outline: 2px solid hsl(var(--ring) / 0.65); outline-offset: 3px; }
|
||||
.appearance-theme-check { opacity: 0; }
|
||||
.appearance-theme-option input:checked + .appearance-theme-card .appearance-theme-check { opacity: 1; }
|
||||
.appearance-theme-option input:checked + .appearance-theme-card { border-color: hsl(var(--foreground) / 0.5); }
|
||||
@@ -77,11 +77,11 @@ html[data-custom-background] .appearance-reading-card { background: hsl(var(--se
|
||||
html[data-custom-background] .appearance-reading-preview { background: hsl(var(--background) / 0.35); }
|
||||
|
||||
.background-settings-trigger { display: inline-flex; min-height: 32px; align-items: center; justify-content: flex-end; gap: 8px; font-size: 13px; }
|
||||
.background-settings-row:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: -2px; }
|
||||
:where(:root:not([data-focus-modality="pointer"])) .background-settings-row:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: -2px; }
|
||||
.background-settings-thumbnail { width: 52px; height: 32px; border-radius: 7px; background: var(--custom-background-image) center / cover; box-shadow: inset 0 0 0 1px hsl(var(--border) / 0.7); }
|
||||
.background-settings-dialog { width: min(440px, calc(100vw - 32px)); gap: 16px; }
|
||||
.background-settings-preview { position: relative; display: flex; width: 100%; min-width: 0; max-width: 100%; aspect-ratio: 16 / 9; min-height: 180px; align-items: center; justify-content: center; overflow: hidden; border: 1px solid hsl(var(--border) / 0.65); border-radius: var(--radius-panel); background-color: hsl(var(--muted) / 0.5); background-position: center; background-size: cover; cursor: pointer; }
|
||||
.background-settings-preview:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 3px; }
|
||||
:where(:root:not([data-focus-modality="pointer"])) .background-settings-preview:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 3px; }
|
||||
.background-settings-preview-action { position: absolute; z-index: 1; right: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 0 10px; border: 1px solid hsl(var(--border) / 0.7); border-radius: var(--radius-control); background: hsl(var(--background) / 0.9); color: hsl(var(--foreground)); font-size: 12px; box-shadow: 0 1px 4px hsl(var(--foreground) / 0.1); }
|
||||
.background-settings-footer { display: flex; flex-direction: row; align-items: center; justify-content: flex-end; gap: 8px; }
|
||||
.background-settings-remove { margin-right: auto; }
|
||||
@@ -92,7 +92,7 @@ html[data-custom-background] .appearance-reading-preview { background: hsl(var(-
|
||||
.background-blur-control input[type="range"]::-moz-range-track { height: 4px; border-radius: 999px; background: linear-gradient(to right, hsl(var(--foreground) / 0.65) var(--slider-progress), hsl(var(--muted-foreground) / 0.22) var(--slider-progress)); }
|
||||
.background-blur-control input[type="range"]::-webkit-slider-thumb { appearance: none; width: 16px; height: 16px; margin-top: -6px; border: 1px solid hsl(var(--foreground) / 0.45); border-radius: 50%; background: hsl(var(--background)); box-shadow: 0 1px 3px hsl(var(--foreground) / 0.18); }
|
||||
.background-blur-control input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border: 1px solid hsl(var(--foreground) / 0.45); border-radius: 50%; background: hsl(var(--background)); box-shadow: 0 1px 3px hsl(var(--foreground) / 0.18); }
|
||||
.background-blur-control input[type="range"]:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 3px; border-radius: 4px; }
|
||||
:where(:root:not([data-focus-modality="pointer"])) .background-blur-control input[type="range"]:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 3px; border-radius: 4px; }
|
||||
.background-blur-control input[type="range"]:disabled { cursor: default; opacity: 0.5; }
|
||||
.background-settings-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: hsl(var(--muted-foreground)); font-size: 13px; }
|
||||
.background-settings-preview:hover .background-settings-empty { color: hsl(var(--foreground)); }
|
||||
@@ -495,7 +495,7 @@ function ToolsPanel({
|
||||
return (
|
||||
<label
|
||||
key={toolName}
|
||||
className="flex min-h-11 cursor-pointer items-center gap-3 border-b border-border/45 px-3.5 py-2.5 transition-colors last:border-b-0 settings-hover has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-inset has-[:focus-visible]:ring-ring"
|
||||
className="flex min-h-11 cursor-pointer items-center gap-3 border-b border-border/45 px-3.5 py-2.5 transition-colors last:border-b-0 settings-hover has-focus-visible:ring-2 has-focus-visible:ring-inset has-focus-visible:ring-ring"
|
||||
>
|
||||
<span className="relative h-5 w-5 shrink-0">
|
||||
<input
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { surfaceFocusProps } from "@/lib/surface-focus";
|
||||
import { FullAccessIcon, RestrictedAccessIcon, WorkspaceIcon } from "@/components/icons/product-icons";
|
||||
import type { HTMLAttributes, ReactElement, RefObject } from "react";
|
||||
import { useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
||||
@@ -645,8 +644,8 @@ export function WorkspaceProjectPicker({ disabled, scope, defaultScope, controls
|
||||
</nav>}
|
||||
<div className={cn("mr-[var(--picker-toolbar-inset)] flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-[var(--picker-field-radius)] bg-[#fcfcfc] dark:bg-muted", compact && showLocations && canBrowse && "hidden")}>
|
||||
<div ref={attachColumns} data-workspace-columns className="sidebar-scrollbar flex flex-1 min-h-0 min-w-0 overflow-x-auto overscroll-x-contain">
|
||||
{columns.map((column, columnIndex) => (!compact || columnIndex === currentColumnIndex) && <WorkspaceDirectoryColumn key={columnIndex} {...surfaceFocusProps} options={column.options} selectedPath={column.selectedPath} initialScrollTop={previewingPath ? 0 : currentVisit.scrollTops[columnIndex] ?? 0} visitRevision={history.revision} activeIndex={highlightActive && columnIndex === activeColumn ? activeOption : null}
|
||||
id={`${optionsId}-${columnIndex}`} data-workspace-column={columnIndex} data-current-directory={columnIndex === currentColumnIndex ? "" : undefined} role="listbox" tabIndex={0} aria-activedescendant={highlightActive && columnIndex === activeColumn && column.options.length ? `${optionsId}-${columnIndex}-${activeOption}` : undefined} aria-label={column.path || t("thread.composer.workspace.projectAria")} aria-busy={columnIndex === currentColumnIndex && loading} style={{ width: `${compact ? 100 : 100 / columnCount}%` }} className="sidebar-scrollbar relative min-w-0 shrink-0 overflow-x-hidden overflow-y-auto px-2 outline-none [scrollbar-gutter:stable] data-[keyboard-focus]:ring-2 data-[keyboard-focus]:ring-inset data-[keyboard-focus]:ring-ring/50"
|
||||
{columns.map((column, columnIndex) => (!compact || columnIndex === currentColumnIndex) && <WorkspaceDirectoryColumn key={columnIndex} options={column.options} selectedPath={column.selectedPath} initialScrollTop={previewingPath ? 0 : currentVisit.scrollTops[columnIndex] ?? 0} visitRevision={history.revision} activeIndex={highlightActive && columnIndex === activeColumn ? activeOption : null}
|
||||
id={`${optionsId}-${columnIndex}`} data-workspace-column={columnIndex} data-current-directory={columnIndex === currentColumnIndex ? "" : undefined} role="listbox" tabIndex={0} aria-activedescendant={highlightActive && columnIndex === activeColumn && column.options.length ? `${optionsId}-${columnIndex}-${activeOption}` : undefined} aria-label={column.path || t("thread.composer.workspace.projectAria")} aria-busy={columnIndex === currentColumnIndex && loading} style={{ width: `${compact ? 100 : 100 / columnCount}%` }} className="sidebar-scrollbar relative min-w-0 shrink-0 overflow-x-hidden overflow-y-auto px-2 outline-none [scrollbar-gutter:stable] focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/50"
|
||||
onFocus={event => { if (event.target === event.currentTarget) { setActiveColumn(columnIndex); setActiveIndex(0); } }}
|
||||
onKeyDown={event => {
|
||||
if (event.target !== event.currentTarget || event.altKey || event.metaKey || event.ctrlKey || pickingFolder) return;
|
||||
|
||||
@@ -217,6 +217,7 @@ function FileUnifiedDiff({
|
||||
className={cn(
|
||||
"inline-flex items-center gap-1 rounded px-1 py-0.5 text-[11px] font-medium",
|
||||
"text-muted-foreground transition-colors hover:bg-muted/65 hover:text-foreground",
|
||||
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
||||
)}
|
||||
data-testid="file-edit-diff-expand-lines"
|
||||
onClick={() => setExpandedLines(true)}
|
||||
@@ -235,6 +236,7 @@ function FileUnifiedDiff({
|
||||
className={cn(
|
||||
"inline-flex items-center gap-1 rounded px-1 py-0.5 text-[11px] font-medium",
|
||||
"text-muted-foreground transition-colors hover:bg-muted/65 hover:text-foreground",
|
||||
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
||||
)}
|
||||
data-testid="file-edit-diff-collapse-lines"
|
||||
onClick={() => setExpandedLines(false)}
|
||||
@@ -258,6 +260,7 @@ function FileUnifiedDiff({
|
||||
className={cn(
|
||||
"inline-flex items-center gap-1 rounded px-1 py-0.5 font-medium",
|
||||
"text-muted-foreground transition-colors hover:bg-muted/65 hover:text-foreground",
|
||||
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
||||
)}
|
||||
data-testid="file-edit-diff-open-file"
|
||||
onClick={() => onOpenFilePreview(previewPath)}
|
||||
@@ -284,6 +287,7 @@ function FileUnifiedDiff({
|
||||
className={cn(
|
||||
"flex w-full cursor-pointer items-center gap-2 rounded-md border border-border/45 bg-muted/35 px-2 py-1 text-left",
|
||||
"text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted/50",
|
||||
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
||||
)}
|
||||
>
|
||||
<ChevronRight
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
.goal-island-trigger:focus-visible {
|
||||
outline: none;
|
||||
}
|
||||
.goal-island-trigger:focus-visible > span:last-child {
|
||||
:where(:root:not([data-focus-modality="pointer"])) .goal-island-trigger:focus-visible > span:last-child {
|
||||
text-decoration: underline;
|
||||
text-decoration-thickness: 2px;
|
||||
text-underline-offset: 4px;
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
.reasoning-effort-slider:has(input:focus-visible) .reasoning-effort-track {
|
||||
:where(:root:not([data-focus-modality="pointer"])) .reasoning-effort-slider:has(input:focus-visible) .reasoning-effort-track {
|
||||
outline: 2px solid hsl(var(--ring));
|
||||
outline-offset: 5px;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { surfaceFocusProps } from "@/lib/surface-focus";
|
||||
import { useCallback, useEffect, useRef, useState, type PointerEvent } from "react";
|
||||
import { Minus, Plus } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -122,8 +121,8 @@ export function ImageViewport({
|
||||
const buttonClass = "grid size-9 shrink-0 place-items-center rounded-full transition-colors hover:text-foreground disabled:opacity-30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";
|
||||
|
||||
return <>
|
||||
<div ref={viewport} data-testid={testId} {...surfaceFocusProps} tabIndex={0} role="group" aria-label={t("lightbox.gestures")}
|
||||
className={cn("flex min-h-0 min-w-0 touch-none select-none items-center justify-center overflow-hidden outline-none data-[keyboard-focus]:ring-1 data-[keyboard-focus]:ring-ring", view.scale > 1 ? dragging ? "cursor-grabbing" : "cursor-grab" : "cursor-zoom-in", className)}
|
||||
<div ref={viewport} data-testid={testId} tabIndex={0} role="group" aria-label={t("lightbox.gestures")}
|
||||
className={cn("flex min-h-0 min-w-0 touch-none select-none items-center justify-center overflow-hidden outline-none focus-visible:ring-1 focus-visible:ring-ring", view.scale > 1 ? dragging ? "cursor-grabbing" : "cursor-grab" : "cursor-zoom-in", className)}
|
||||
onPointerDown={onPointerDown} onPointerMove={onPointerMove} onPointerUp={endPointer} onPointerCancel={endPointer} onLostPointerCapture={endPointer}
|
||||
onDoubleClick={(event) => zoom(viewRef.current.scale > 1 ? 1 : 2, { x: event.clientX, y: event.clientY })}
|
||||
onKeyDown={(event) => {
|
||||
|
||||
Reference in new issue
Block a user