Replace Focusable navigation wrappers with tabIndex-based focus handling
This commit is contained in:
1 parent
d336eba27d
commit
5d8cf10bf1
11 files changed
+133
-382
No files matched your search
+15
-17
@@ -2,7 +2,6 @@ import {
|
||||
Button,
|
||||
type ButtonProps,
|
||||
Column,
|
||||
Focusable,
|
||||
Icon,
|
||||
Row,
|
||||
Text,
|
||||
@@ -111,22 +110,21 @@ export function SideNav(props: any) {
|
||||
{links.map(({ id, path, label, icon }) => {
|
||||
const isSelected = pathname.startsWith(renderUrl(path, false));
|
||||
const content = (
|
||||
<Focusable>
|
||||
<Row
|
||||
alignItems="center"
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
backgroundColor={isSelected ? 'surface-sunken' : undefined}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel
|
||||
icon={icon}
|
||||
label={isCollapsed ? '' : label}
|
||||
weight={isSelected ? 'bold' : undefined}
|
||||
padding
|
||||
/>
|
||||
</Row>
|
||||
</Focusable>
|
||||
<Row
|
||||
tabIndex={0}
|
||||
alignItems="center"
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
backgroundColor={isSelected ? 'surface-sunken' : undefined}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel
|
||||
icon={icon}
|
||||
label={isCollapsed ? '' : label}
|
||||
weight={isSelected ? 'bold' : undefined}
|
||||
padding
|
||||
/>
|
||||
</Row>
|
||||
);
|
||||
return (
|
||||
<Link key={id} href={renderUrl(path, false)} role="button">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Column, Focusable, Row, Tooltip, TooltipTrigger } from '@umami/react-zen';
|
||||
import { Column, Row, Tooltip, TooltipTrigger } from '@umami/react-zen';
|
||||
import { IconLabel } from '@/components/common/IconLabel';
|
||||
import Link from '@/components/common/Link';
|
||||
import { NavMenu } from '@/components/common/NavMenu';
|
||||
@@ -49,16 +49,15 @@ export function AdminNav({ onItemClick }: { onItemClick?: () => void }) {
|
||||
<Column gap="2">
|
||||
<Link href={renderUrl('/websites', false)} role="button" onClick={onItemClick}>
|
||||
<TooltipTrigger delay={0}>
|
||||
<Focusable>
|
||||
<Row
|
||||
alignItems="center"
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel icon={<ArrowLeft />} label={t(labels.back)} padding />
|
||||
</Row>
|
||||
</Focusable>
|
||||
<Row
|
||||
tabIndex={0}
|
||||
alignItems="center"
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel icon={<ArrowLeft />} label={t(labels.back)} padding />
|
||||
</Row>
|
||||
<Tooltip placement="right">{t(labels.back)}</Tooltip>
|
||||
</TooltipTrigger>
|
||||
</Link>
|
||||
|
||||
@@ -1,13 +1,4 @@
|
||||
import {
|
||||
Button,
|
||||
Column,
|
||||
Focusable,
|
||||
ListItem,
|
||||
Row,
|
||||
Select,
|
||||
Text,
|
||||
TextField,
|
||||
} from '@umami/react-zen';
|
||||
import { Button, Column, ListItem, Row, Select, Text, TextField } from '@umami/react-zen';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { useApi, useMessages } from '@/components/hooks';
|
||||
import { LinkSelect } from '@/components/input/LinkSelect';
|
||||
@@ -465,34 +456,34 @@ export function BoardComponentSelect({
|
||||
const Icon = def.icon;
|
||||
|
||||
return (
|
||||
<Focusable key={def.type}>
|
||||
<Row
|
||||
gap="3"
|
||||
alignItems="flex-start"
|
||||
paddingX="3"
|
||||
paddingY="2"
|
||||
borderRadius
|
||||
backgroundColor={
|
||||
selectedDef?.type === def.type ? 'surface-sunken' : undefined
|
||||
}
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
style={{ cursor: 'pointer' }}
|
||||
onClick={() => handleSelectComponent(def)}
|
||||
>
|
||||
<Icon size={16} />
|
||||
<Column gap="1">
|
||||
<Text
|
||||
size="sm"
|
||||
weight={selectedDef?.type === def.type ? 'bold' : undefined}
|
||||
>
|
||||
{def.name}
|
||||
</Text>
|
||||
<Text size="xs" color="muted">
|
||||
{def.description}
|
||||
</Text>
|
||||
</Column>
|
||||
</Row>
|
||||
</Focusable>
|
||||
<Row
|
||||
key={def.type}
|
||||
tabIndex={0}
|
||||
gap="3"
|
||||
alignItems="flex-start"
|
||||
paddingX="3"
|
||||
paddingY="2"
|
||||
borderRadius
|
||||
backgroundColor={
|
||||
selectedDef?.type === def.type ? 'surface-sunken' : undefined
|
||||
}
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
style={{ cursor: 'pointer' }}
|
||||
onClick={() => handleSelectComponent(def)}
|
||||
>
|
||||
<Icon size={16} />
|
||||
<Column gap="1">
|
||||
<Text
|
||||
size="sm"
|
||||
weight={selectedDef?.type === def.type ? 'bold' : undefined}
|
||||
>
|
||||
{def.name}
|
||||
</Text>
|
||||
<Text size="xs" color="muted">
|
||||
{def.description}
|
||||
</Text>
|
||||
</Column>
|
||||
</Row>
|
||||
);
|
||||
})}
|
||||
</Column>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Column, Focusable, Row, Text, Tooltip, TooltipTrigger } from '@umami/react-zen';
|
||||
import { Column, Row, Text, Tooltip, TooltipTrigger } from '@umami/react-zen';
|
||||
import { IconLabel } from '@/components/common/IconLabel';
|
||||
import Link from '@/components/common/Link';
|
||||
import { useMessages, useNavigation } from '@/components/hooks';
|
||||
@@ -60,16 +60,15 @@ export function SettingsNav({
|
||||
<Link href={renderUrl('/websites', false)} role="button" onClick={onItemClick}>
|
||||
{(() => {
|
||||
const content = (
|
||||
<Focusable>
|
||||
<Row
|
||||
alignItems="center"
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel icon={<ArrowLeft />} label={isCollapsed ? '' : t(labels.back)} padding />
|
||||
</Row>
|
||||
</Focusable>
|
||||
<Row
|
||||
tabIndex={0}
|
||||
alignItems="center"
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel icon={<ArrowLeft />} label={isCollapsed ? '' : t(labels.back)} padding />
|
||||
</Row>
|
||||
);
|
||||
|
||||
return isCollapsed ? (
|
||||
@@ -92,22 +91,21 @@ export function SettingsNav({
|
||||
{sectionItems.map(({ id, path, label, icon }) => {
|
||||
const isSelected = selectedKey === id;
|
||||
const content = (
|
||||
<Focusable>
|
||||
<Row
|
||||
alignItems="center"
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
backgroundColor={isSelected ? 'surface-sunken' : undefined}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel
|
||||
icon={icon}
|
||||
label={isCollapsed ? '' : label}
|
||||
weight={isSelected ? 'bold' : undefined}
|
||||
padding
|
||||
/>
|
||||
</Row>
|
||||
</Focusable>
|
||||
<Row
|
||||
tabIndex={0}
|
||||
alignItems="center"
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
backgroundColor={isSelected ? 'surface-sunken' : undefined}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel
|
||||
icon={icon}
|
||||
label={isCollapsed ? '' : label}
|
||||
weight={isSelected ? 'bold' : undefined}
|
||||
padding
|
||||
/>
|
||||
</Row>
|
||||
);
|
||||
return (
|
||||
<Link key={id} href={path} role="button" onClick={onItemClick}>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Column, Focusable, Icon, Row, Text, Tooltip, TooltipTrigger } from '@umami/react-zen';
|
||||
import { Column, Icon, Row, Text, Tooltip, TooltipTrigger } from '@umami/react-zen';
|
||||
import classNames from 'classnames';
|
||||
import { useMemo, useState } from 'react';
|
||||
import { firstBy } from 'thenby';
|
||||
@@ -232,9 +232,7 @@ export function Journey({ websiteId, steps, startStep, endStep, view }: JourneyP
|
||||
<div>{formatLongNumber(nodeCount)}</div>
|
||||
) : (
|
||||
<TooltipTrigger delay={0}>
|
||||
<Focusable>
|
||||
<div>{formatLongNumber(nodeCount)}</div>
|
||||
</Focusable>
|
||||
<div tabIndex={0}>{formatLongNumber(nodeCount)}</div>
|
||||
<Tooltip placement="top" sideOffset={20} showArrow>
|
||||
<Text transform="lowercase" color="red">
|
||||
{`${dropped}% ${t(labels.dropoff)}`}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Column, Focusable, Row, Text, Tooltip, TooltipTrigger } from '@umami/react-zen';
|
||||
import { Column, Row, Text, Tooltip, TooltipTrigger } from '@umami/react-zen';
|
||||
import { IconLabel } from '@/components/common/IconLabel';
|
||||
import Link from '@/components/common/Link';
|
||||
import { useMessages, useNavigation, useWebsiteNavItems } from '@/components/hooks';
|
||||
@@ -22,16 +22,15 @@ export function WebsiteNav({
|
||||
<Link href={renderUrl('/websites', false)} role="button" onClick={onItemClick}>
|
||||
{isCollapsed ? (
|
||||
<TooltipTrigger delay={0}>
|
||||
<Focusable>
|
||||
<Row
|
||||
alignItems="center"
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel icon={<ArrowLeft />} label="" padding />
|
||||
</Row>
|
||||
</Focusable>
|
||||
<Row
|
||||
tabIndex={0}
|
||||
alignItems="center"
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel icon={<ArrowLeft />} label="" padding />
|
||||
</Row>
|
||||
<Tooltip placement="right">{t(labels.back)}</Tooltip>
|
||||
</TooltipTrigger>
|
||||
) : (
|
||||
@@ -58,22 +57,21 @@ export function WebsiteNav({
|
||||
<Link key={id} href={path} role="button" onClick={onItemClick}>
|
||||
{isCollapsed ? (
|
||||
<TooltipTrigger delay={0}>
|
||||
<Focusable>
|
||||
<Row
|
||||
alignItems="center"
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
backgroundColor={isSelected ? 'surface-sunken' : undefined}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel
|
||||
icon={icon}
|
||||
label=""
|
||||
weight={isSelected ? 'bold' : undefined}
|
||||
padding
|
||||
/>
|
||||
</Row>
|
||||
</Focusable>
|
||||
<Row
|
||||
tabIndex={0}
|
||||
alignItems="center"
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
backgroundColor={isSelected ? 'surface-sunken' : undefined}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel
|
||||
icon={icon}
|
||||
label=""
|
||||
weight={isSelected ? 'bold' : undefined}
|
||||
padding
|
||||
/>
|
||||
</Row>
|
||||
<Tooltip placement="right">{label}</Tooltip>
|
||||
</TooltipTrigger>
|
||||
) : (
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import {
|
||||
Button,
|
||||
Column,
|
||||
Focusable,
|
||||
Icon,
|
||||
Row,
|
||||
Text,
|
||||
@@ -179,22 +178,17 @@ export function ShareNav({
|
||||
<Link key={id} href={path} role="button" onClick={onItemClick}>
|
||||
{collapsed ? (
|
||||
<TooltipTrigger delay={0}>
|
||||
<Focusable>
|
||||
<Row
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
backgroundColor={isSelected ? 'surface-sunken' : undefined}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel
|
||||
icon={icon}
|
||||
label=""
|
||||
weight={isSelected ? 'bold' : undefined}
|
||||
/>
|
||||
</Row>
|
||||
</Focusable>
|
||||
<Row
|
||||
tabIndex={0}
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
backgroundColor={isSelected ? 'surface-sunken' : undefined}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel icon={icon} label="" weight={isSelected ? 'bold' : undefined} />
|
||||
</Row>
|
||||
<Tooltip placement="right">{label}</Tooltip>
|
||||
</TooltipTrigger>
|
||||
) : (
|
||||
|
||||
Reference in new issue
Block a user