# Tabs / segmented

Tabs đổi panel cùng cấp: Classic tra cứu đơn, composer inbox Chat / Note / Reminder và Knowledge files dùng Tabs của kit.

## Key rules

- Classic: TrackingTab có hai tab, gạch chân `--faqsBrandColor`, activation automatic.
- Admin: tab Chat / Note / Reminder của composer, activation manual.
- Admin · Knowledge files: `Tabs` + `TabsTrigger` cao 40px, không xử lý phím mũi tên.
- Element `chatty-tabs` ở mục Standard là chuẩn cho Classic và inbox; Knowledge files chuyển sang Polaris.

## Use when / Avoid

Dùng khi các lựa chọn cùng cấp và đổi panel trong cùng ngữ cảnh, ví dụ Test / Problems / Outline. Không dùng tabs cho bước tuần tự hay hành động một lần. Segmented control chưa có component riêng.

### Use instead

| Component | Use when |
| --- | --- |
| `Tabs` | Đổi panel bên phải Knowledge files: Test, Problems, Outline. |
| `TabsTrigger` | Hàng file đang mở trong editor, mỗi tab kèm nút đóng. |
| `handleTabKeyDown` | Caller cần mũi tên, Home, End: Classic TrackingTab và admin inbox đã gắn. |

## Live preview

Example (Standard) — Element chatty-tabs gạch chân, activation automatic; token Classic.

```html
<chatty-tabs label="Knowledge file tools" style="width: 100%">
  <chatty-tab>Test</chatty-tab>
  <chatty-tab>Problems</chatty-tab>
  <chatty-tab>Outline</chatty-tab>
  <chatty-tab-panel>Ask a question to test this file.</chatty-tab-panel>
  <chatty-tab-panel>No problems found.</chatty-tab-panel>
  <chatty-tab-panel>Headings of the file.</chatty-tab-panel>
</chatty-tabs>
```

Example (Standard) — Kiểu segmented, activation manual và tab disabled; token Classic.

```html
<chatty-tabs segmented activation="manual" selected-index="1" label="Order view" style="width: 100%">
  <chatty-tab>Details</chatty-tab>
  <chatty-tab>Tracking</chatty-tab>
  <chatty-tab disabled>Returns</chatty-tab>
  <chatty-tab-panel>Items and totals.</chatty-tab-panel>
  <chatty-tab-panel>In transit, arriving Friday.</chatty-tab-panel>
  <chatty-tab-panel>No returns.</chatty-tab-panel>
</chatty-tabs>
```

Example (Standard) — Element chatty-tabs gạch chân, activation automatic; token admin.

```html
<chatty-tabs label="Knowledge file tools" style="width: 100%">
  <chatty-tab>Test</chatty-tab>
  <chatty-tab>Problems</chatty-tab>
  <chatty-tab>Outline</chatty-tab>
  <chatty-tab-panel>Ask a question to test this file.</chatty-tab-panel>
  <chatty-tab-panel>No problems found.</chatty-tab-panel>
  <chatty-tab-panel>Headings of the file.</chatty-tab-panel>
</chatty-tabs>
```

Example (Standard) — Kiểu segmented, activation manual và tab disabled; token admin.

```html
<chatty-tabs segmented activation="manual" selected-index="1" label="Order view" style="width: 100%">
  <chatty-tab>Details</chatty-tab>
  <chatty-tab>Tracking</chatty-tab>
  <chatty-tab disabled>Returns</chatty-tab>
  <chatty-tab-panel>Items and totals.</chatty-tab-panel>
  <chatty-tab-panel>In transit, arriving Friday.</chatty-tab-panel>
  <chatty-tab-panel>No returns.</chatty-tab-panel>
</chatty-tabs>
```

Example (Current (React), being replaced) — Tablist của TrackingTab: hai tab, activation automatic; JSX lấy từ caller TrackingTab.

```jsx
import {typeRole} from '@avada/chatty-ui/styles/typeRole';

import {handleTabKeyDown} from '@avada/chatty-ui/components/tabKeyboard.js';

                className="Avada-Faqs_TrackTab-tabs"
```

Example (Current (React), being replaced) — Tablist Chat / Note / Reminder của composer inbox, activation manual; JSX lấy từ caller ChatBox.

```jsx
import {handleTabKeyDown} from '@avada/chatty-ui/components/tabKeyboard.js';

                onKeyDown={event => handleTabKeyDown(event, {activation: 'manual'})}

/**
 * Render a composer tab whose keyboard focus is independent of its selected mode.
 * @param {Object} tab
 * @param {boolean} selected
 * @param {number} tabIndex
 * @param {Function} onFocus
 * @param {Function} onChange
 */
function MessageTab({tab, selected, tabIndex, onFocus, onChange}) {
  return (
    <button
      type="button"
      className="Avada-Faqs__MessageTab"
      role="tab"
      aria-selected={selected}
      tabIndex={tabIndex}
      onFocus={onFocus}
      onClick={e => onChange(e, tab.value)}
      {...tab.props}
    >
      {tab.label}
    </button>
  );
}
```

Example (Current (React), being replaced) — Chọn Test, Problems hoặc Outline; tab dùng CSS của Knowledge files.

```jsx
import React, {useState} from 'react';
import {Tabs, TabsList, TabsTrigger} from '@avada/chatty-ui/components/tabs.js';
export function Panels() {
  const [selected, setSelected] = useState('run');
  return <Tabs className="kb-ide__right-tabs">
    <TabsList className="kb-ide__right-header">
      {['run', 'problems', 'outline'].map(value => (
        <TabsTrigger key={value} active={selected === value} onClick={() => setSelected(value)}>
          {value === 'run' ? 'Test' : value === 'problems' ? 'Problems' : 'Outline'}
        </TabsTrigger>
      ))}
    </TabsList>
    <div className="kb-ide__right-scroll">{selected} panel</div>
  </Tabs>;
}
```

## Standard

Example (Standard) — Element chatty-tabs gạch chân, activation automatic; token Classic.

```html
<chatty-tabs label="Knowledge file tools" style="width: 100%">
  <chatty-tab>Test</chatty-tab>
  <chatty-tab>Problems</chatty-tab>
  <chatty-tab>Outline</chatty-tab>
  <chatty-tab-panel>Ask a question to test this file.</chatty-tab-panel>
  <chatty-tab-panel>No problems found.</chatty-tab-panel>
  <chatty-tab-panel>Headings of the file.</chatty-tab-panel>
</chatty-tabs>
```

Prototype  (cùng `tab.js`, `tab-panel.js`, các file styles và ) là chuẩn: chatty-ui port 1:1 các file này, và `chatty-ui/custom-elements.json` sinh từ chính prototype. Tab và panel là con light DOM của `chatty-tabs`, ghép theo thứ tự, để aria-controls và aria-labelledby nằm cùng tree. Knowledge files vẫn chuyển sang Polaris theo Target; element dành cho Classic và inbox.

### Element

| Element | Module |
| --- | --- |
| `chatty-tabs` | @avada/chatty-ui/elements/tabs.js |
| `chatty-tab` | @avada/chatty-ui/elements/tab.js |
| `chatty-tab-panel` | @avada/chatty-ui/elements/tab-panel.js |

### API

| Element | Kind | Name | Type | Default | Description |
| --- | --- | --- | --- | --- | --- |
| chatty-tabs | attribute | `activation` | automatic, manual | `'automatic'` | automatic chọn tab khi di chuyển bằng mũi tên; manual chờ Enter, Space hoặc click. |
| chatty-tabs | attribute | `segmented` | boolean | `false` | Kiểu segmented: nền chung và tab đang chọn nổi lên, không gạch chân. |
| chatty-tabs | attribute | `label` | string | `''` | Tên truy cập của tablist. |
| chatty-tabs | attribute | `selected-index` | number | `0` | Vị trí tab đang chọn, tính từ 0. |
| chatty-tabs | event | `change` | Event | – | Tab đang chọn đổi do người dùng; đọc selectedIndex. |
| chatty-tabs | slot | default | – | – | Các chatty-tab-panel, theo thứ tự tab. |
| chatty-tabs | slot | `tab` | – | – | Các chatty-tab; chatty-tab tự gán vào slot này. |
| chatty-tabs | part | `base` | – | – | Hàng tablist. |
| chatty-tabs | css-property | `--chatty-tabs-height` | – | – | Chiều cao hàng tab. |
| chatty-tabs | css-property | `--chatty-tab-indicator` | – | – | Màu gạch chân tab đang chọn; mặc định màu chữ, tách khỏi token focus ring. |
| chatty-tab | attribute | `disabled` | boolean | `false` | Không chọn được; mũi tên bỏ qua tab này và báo aria-disabled. |
| chatty-tab | attribute | `selected` | boolean | `false` | Do chatty-tabs đặt theo selected-index; dùng cho style. |
| chatty-tab | slot | default | – | – | Nhãn tab. |
| chatty-tab | slot | `end` | – | – | Nội dung đứng sau nhãn, ví dụ số đếm hoặc nút đóng. |
| chatty-tab | part | `base` | – | – | Khung tab. |
| chatty-tab | part | `end` | – | – | Vùng chứa slot end. |
| chatty-tab-panel | slot | default | – | – | Nội dung panel. |
| chatty-tab-panel | part | `base` | – | – | Khung panel. |

## Classic

### Import / element

| Component / element | Import / file | Scope root |
| --- | --- | --- |
| `TrackingTab` | import TrackingTab from '@scripttag/v1/MuiPages/TrackingTab.js' | .Avada-Faqs_Popup .Avada-Faqs_TrackTab-container |
| `handleTabKeyDown` | @avada/chatty-ui/components/tabKeyboard.js | Gắn lên tablist của TrackingTab |

### Anatomy

| Part | Element |
| --- | --- |
| 1 | Tablist: div `Avada-Faqs_TrackTab-tabs` có role tablist, `display: flex`. |
| 2 | Tab: native button `Avada-Faqs_TrackTab-tab` có role tab, aria-selected và tabIndex. |
| 3 | Gạch chân: viền dưới 2px của chính button, không có indicator riêng. |
| 4 | Vùng nội dung: field và radio ngay sau tablist, không có role tabpanel. |

### Placement / order

| Context | Order |
| --- | --- |
| TrackingTab | Tablist đứng đầu container (flex column, cách 16px): Order number rồi Tracking number, sau đó field của tab đang chọn. |
| Hiện tablist | Chỉ render khi linkStrategy khác default và không phải luồng template chỉ có một form. |

### Props

| Prop | Type | Values | Default | Notes |
| --- | --- | --- | --- | --- |
| `aria-selected` | boolean | true / false | `selectedTab === 0` ở tab đầu | Tab chưa chọn mờ theo selector aria-selected false. |
| `tabIndex` | number | 0 / -1 | 0 ở tab đang chọn | Chỉ tab đang chọn nằm trong thứ tự Tab. |
| `disabled` | boolean | `loading` | false khi chưa tra cứu | Khoá cả hai tab trong lúc tra cứu. |
| `selectedTab` | state | 0 / 1 | `useState(0)` | Khôi phục từ `trackSelectedTab` trong storage. |

### Sizes

| Size | Height | Padding | Gap | Radius | Font role (px/rem) | Hit target | Breakpoint / mechanism |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Tablist `Avada-Faqs_TrackTab-tabs` | Theo nội dung | Không khai báo | Không khai báo | Không khai báo | Không có chữ trực tiếp | Không tương tác | `display: flex`, hai tab chia đều |
| Tab `Avada-Faqs_TrackTab-tab` | Theo padding và line-height | `6px 0` | Không khai báo | Không khai báo | button-label: Derived(14px = type(button-label, desktop, size)) / Derived(18px = type(button-label, desktop, line)) desktop → Derived(17px = type(button-label, mobile, size)) / Derived(24px = type(button-label, mobile, line)) mobile; weight 500 | Rộng 50%, `flex: 1` | Role mobile khi mobileMaxWidth 899px |

### Tokens

| Part | Token | Light | Dark |
| --- | --- | --- | --- |
| Chữ tab | `--faqsTextColor` | Merchant; fallback #944ecf | Theo `--faqsTextColor` |
| Gạch chân đang chọn | `--faqsBrandColor` | Merchant; fallback #944ecf | #ffffff |
| Gạch chân chưa chọn | `border-bottom` | `2px solid transparent` | rgba(255, 255, 255, 0.15) |
| Focus ring | `--chatty-ring` | Fallback #303030 | Fallback #eee |

### States

| State | Trigger | Visual change (values) | ARIA/attribute |
| --- | --- | --- | --- |
| Chưa chọn | `selectedTab` khác index | opacity 0.6; viền dưới 2px trong suốt | aria-selected false, tabIndex -1 |
| Đang chọn | `selectedTab` khớp index | Thêm class `Avada-Faqs_TrackTab-tab--active`: viền dưới `--faqsBrandColor` (fallback #944ecf) | aria-selected true, tabIndex 0 |
| Dark | data-theme dark | Viền dưới 2px rgba(255, 255, 255, 0.15); đang chọn 2px #ffffff | Không đổi |
| Focus-visible | keyboard | outline 2px `--chatty-ring`, `outline-offset: 2px` | Native focus |
| Disabled | `loading` true | Không có style riêng cho tab | Native disabled |

### Behaviour

| Interaction | Result |
| --- | --- |
| Chọn tab | `handleTabChange` bỏ qua khi `loading`; lưu `trackSelectedTab`, xoá lỗi và giá trị field. |
| Mũi tên / Home / End | activation automatic: chuyển focus rồi click tab mới; RTL đảo chiều mũi tên. |
| Khôi phục | Khi mount đọc `trackSelectedTab` từ storage nếu linkStrategy khác default. |
| Nhãn dài | `white-space: nowrap`; không clamp. |

### Copy

| String | i18n key | Where |
| --- | --- | --- |
| Order number | Order number | Tab đầu của TrackingTab |
| Tracking number | Tracking number | Tab thứ hai của TrackingTab |

### Source

| File | Evidence |
| --- | --- |
|  | Markup tablist và state chọn |
|  | Skin Light của tab |
|  | Skin Dark của tab |
|  | Phím mũi tên, Home, End |

## Admin

### Import / element

| Component / element | Import / file | Scope root |
| --- | --- | --- |
| `ChatBox` | import ChatBox from '@assets/pages/InboxManagement/Parts/ChatBox/ChatBox.js' | .Avada-Faqs__Chat-Box__TabMode |
| `handleTabKeyDown` | @avada/chatty-ui/components/tabKeyboard.js | Gắn lên tablist của composer |

### Anatomy

| Part | Element |
| --- | --- |
| 1 | Hàng `Avada-Faqs__Chat-Box__TabMode`: tablist, spacer và nút AI. |
| 2 | Tablist: div có role tablist, cao 30px. |
| 3 | `MessageTab`: native button `Avada-Faqs__MessageTab` có role tab và aria-selected. |
| 4 | Editor Tiptap dưới hàng tab, không có role tabpanel. |

### Placement / order

| Context | Order |
| --- | --- |
| Composer | Chat, Note, Reminder trong tablist; sau đó spacer, AIOptimize và SuggestReply cùng hàng (flex, cách 16px). |
| Compact composer | Mode button thường, không có role tab; chọn mode thì mở composer đầy đủ. |

### Props

| Prop | Type | Values | Default | Notes |
| --- | --- | --- | --- | --- |
| `tab` | object | label, value, props | Không có | label là nhãn; props spread lên button. |
| `selected` | boolean | true / false | Không có | Chuyển thành `aria-selected`. |
| `tabIndex` | number | 0 / -1 | Không có | ChatBox truyền 0 cho tab `focusedMessageTab`, tách khỏi tab đang chọn. |
| `onFocus` | function | Handler | Không có | Ghi lại tab đang focus. |
| `onChange` | function | (event, value) | Không có | Click gọi `onChange(e, tab.value)`. |

### Sizes

| Size | Height | Padding | Gap | Radius | Font role (px/rem) | Hit target | Breakpoint / mechanism |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Tablist | 30px | Không khai báo | Không khai báo | Không khai báo | Không có chữ trực tiếp | Không tương tác | Flex, căn giữa theo chiều dọc |
| Tab `Avada-Faqs__MessageTab` | Theo padding và line-height | `4px 12px` | Không khai báo | 4px | body-medium: Derived(13px = type(body-medium, admin, desktop, size)) / Derived(20px = type(body-medium, admin, desktop, line)) desktop; weight 400, đang chọn 500 | Native box | Hàng `Avada-Faqs__Chat-Box__TabMode` wrap khi hẹp |

### Tokens

| Part | Token | Light | Dark |
| --- | --- | --- | --- |
| Chữ tab | `--chatty-color-text` | Fallback #303030 | No Dark skin |
| Nền đang chọn | `--chatty-color-bg-surface-secondary` | Fallback #f7f7f7 | No Dark skin |
| Gạch chân đang chọn | `--chatty-color-text` | Fallback #303030 | No Dark skin |
| Nền hover | `--chatty-color-bg` | Fallback #f1f1f1 | No Dark skin |
| Focus ring | `--p-color-border-focus` | Fallback #005bd3 | No Dark skin |

### States

| State | Trigger | Visual change (values) | ARIA/attribute |
| --- | --- | --- | --- |
| Chưa chọn | `selected` false | Nền trong suốt; viền dưới 2px trong suốt; weight 400 | aria-selected false |
| Đang chọn | `selected` true | Nền `--chatty-color-bg-surface-secondary` (#f7f7f7); viền dưới `--chatty-color-text`; weight 500 | aria-selected true |
| Hover | pointer | Nền `--chatty-color-bg` (#f1f1f1) | Native |
| Focus-visible | keyboard | outline 2px `--p-color-border-focus` (#005bd3), `outline-offset: 1px` | Native focus |

### Behaviour

| Interaction | Result |
| --- | --- |
| Chọn tab | Click gọi `handleChangeTab`: đổi messageTab, bật note khi chọn Note, bỏ tin đang sửa. |
| Mũi tên / Home / End | activation manual: chỉ chuyển focus, `focusedMessageTab` theo onFocus; Enter hoặc Space bấm button để chọn. |
| Đổi panel | Không có tabpanel; editor mount lại theo `key={messageTab}`, placeholder lấy từ `getTabText`. |
| Tab disabled | Phím bỏ qua tab disabled hoặc aria-disabled true. |

### Copy

| String | i18n key | Where |
| --- | --- | --- |
| Chat | Chat | Tab trả lời khách |
| Note | Note | Tab ghi chú nội bộ |
| Reminder | Reminder | Tab đặt nhắc việc |

### Source

| File | Evidence |
| --- | --- |
|  | Markup tab |
|  | Tablist và handler phím |
|  | Skin tab của composer |
|  | Phím mũi tên, Home, End |

## Admin · Knowledge files

### Import / element

| Component / element | Import / file | Scope root |
| --- | --- | --- |
| `Tabs` + `TabsList` + `TabsTrigger` | @avada/chatty-ui/components | .kb-ide-page > .kb-ide |
| `TabsContent` | @avada/chatty-ui/components | Import có sẵn nhưng RightPanel không render |

### Anatomy

| Part | Element |
| --- | --- |
| 1 | `Tabs`: wrapper div, class `kb-ide__right-tabs`. |
| 2 | `TabsList`: div có role tablist, class `kb-ide__right-header`. |
| 3 | `TabsTrigger`: native button có role tab và aria-selected. |
| 4 | Vùng panel: div `kb-ide__right-scroll` do caller render, không dùng TabsContent. |

### Placement / order

| Context | Order |
| --- | --- |
| RightPanel | Ba trigger theo thứ tự run, problems, outline, rồi vùng panel của tab đang chọn. |
| Editor header | Mỗi tab file là một entry: `TabsTrigger` rồi nút đóng; không có panel liên kết trong component. |

### Props

| Prop | Type | Values | Default | Notes |
| --- | --- | --- | --- | --- |
| `active` | boolean | true / false | Không có | `TabsTrigger` chuyển thành `aria-selected` và chọn class đang chọn. |
| `className` | string | CSS classes | Không có | Gộp cuối trên `Tabs`, TabsList, TabsTrigger và TabsContent. |
| `children` | ReactNode | Caller content | Không có | Render trong element của từng component. |
| `props` | attributes | Native attrs, onClick, aria-\*, disabled | Caller | Spread vào element; caller tự truyền id, aria-controls, onKeyDown. |

### Sizes

| Size | Height | Padding | Gap | Radius | Font role (px/rem) | Hit target | Breakpoint / mechanism |
| --- | --- | --- | --- | --- | --- | --- | --- |
| TabsList `kb-ide__right-header` | 40px | 0 / 8px | Không khai báo | 0 | Không có chữ trực tiếp | Không tương tác | Selector của page ghi đè utility của kit |
| TabsTrigger trong `kb-ide__right-header` | 40px | `0 10px` | Không khai báo | 0 | 13px | Native box 40px | Selector button role tab thắng utility |

### Tokens

| Part | Token | Light | Dark |
| --- | --- | --- | --- |
| Fill của tab | `background: 0 0` | Trong suốt | No Dark skin |
| Chữ tab chưa chọn | `--p-color-text-secondary` | #616161 | No Dark skin |
| Chữ tab đang chọn | `--p-color-text` | #303030 | No Dark skin |
| Gạch chân đang chọn | `--p-color-border-focus` | #005bd3 | No Dark skin |
| Nền header | `--p-color-bg-surface` | #ffffff | No Dark skin |
| Viền dưới header | `--p-color-border-secondary` | #ebebeb | No Dark skin |

### States

| State | Trigger | Visual change (values) | ARIA/attribute |
| --- | --- | --- | --- |
| Chưa chọn | `active` false | Chữ `--p-color-text-secondary`; viền dưới 2px trong suốt | `aria-selected` false |
| Đang chọn | `active` true | Chữ `--p-color-text`; viền dưới `--p-color-border-focus`; không đổi fill | `aria-selected` true |
| Hover | pointer, không disabled | Fill `--p-color-bg-surface-hover` (#f7f7f7) theo rule button của page | Native |
| Focus-visible | keyboard | Rule của page: outline 2px, offset 2px (`outline-offset`); trigger còn có utility `chatty:focus-visible:ring-2` | Native focus |
| Disabled | `disabled` do caller truyền | opacity 0.48, cursor not-allowed (`0.48`) | Native disabled |

### Behaviour

| Interaction | Result |
| --- | --- |
| Chọn tab | Caller giữ state và đổi `active` qua `onClick`; component không tự quản lý selection. |
| Mũi tên / Home / End | Not available trong `Tabs`; RightPanel không truyền onKeyDown, handleTabKeyDown chỉ có ở caller khác. |
| Nối panel | `TabsContent` có role tabpanel nhưng không tự đặt id hay aria-labelledby; RightPanel dùng div thay thế. |
| Nhãn dài | `whitespace-nowrap` trên trigger; không có clamp hay cuộn riêng ở RightPanel. |

### Copy

| String | i18n key | Where |
| --- | --- | --- |
| Test | Test | Tab run của RightPanel, namespace ai-assistant |
| Problems | Problems | Tab problems của RightPanel |
| Outline | Outline | Tab outline của RightPanel |
| Close file | Close file | Nút đóng cạnh tab file trong editor header |
| Unsaved edits | Unsaved edits | Dấu chấm trên tab file đang sửa |

### Source

| File | Evidence |
| --- | --- |
|  | API và class của kit |
|  | Caller tab Test / Problems / Outline |
|  | Skin tab của page |

## Do / Don't

Do: giữ state chọn ở caller và đặt `active` đúng một trigger.

Don't: dùng Tabs của kit cho segmented control hay giả định Tabs tự xử lý phím mũi tên và nối panel.

## Accessibility

Classic: chữ và gạch chân theo màu merchant `--faqsTextColor`, `--faqsBrandColor`, nên không có cặp màu cố định để đo.

Admin: tỷ lệ đo trên nền tab `--chatty-color-bg-surface-secondary` và `--chatty-color-bg`; admin chỉ có Light.

Admin · Knowledge files: tỷ lệ đo trên nền header `--p-color-bg-surface`; admin chỉ có Light.

| Surface | Role / name | Keyboard / focus | Live region | Contrast pair / ratio |
| --- | --- | --- | --- | --- |
| Classic | role tablist và tab; tên tab từ nhãn i18n; tablist không có tên; không có tabpanel | Mũi tên trái, phải, Home, End chuyển focus và chọn ngay (automatic); tabIndex roving 0 / -1; outline 2px `--chatty-ring` khi focus-visible | Không có | Theo màu merchant; tab chưa chọn opacity 0.6; không đo cặp cố định |
| Admin | role tablist và tab; tên từ nhãn Chat / Note / Reminder; tablist không có tên; không có tabpanel | Mũi tên, Home, End chỉ chuyển focus (manual); Enter hoặc Space chọn qua click native; outline 2px `--p-color-border-focus`, offset 1px | Không có | Đang chọn Measured(#303030 / #f7f7f7 = 12.32:1); hover Measured(#303030 / #f1f1f1 = 11.69:1); focus ring Measured(#005bd3 / #f7f7f7 = 5.70:1) |
| Admin · Knowledge files | role tablist, tab, tabpanel; tên tab từ `children`; aria-selected theo active | Mỗi tab là button riêng trong thứ tự Tab; không có mũi tên, Home, End; outline 2px khi focus-visible | Không có | Đang chọn Measured(#303030 / #ffffff = 13.20:1); chưa chọn Measured(#616161 / #ffffff = 6.19:1); gạch chân Measured(#005bd3 / #ffffff = 6.11:1) |

## Target

```target
| Surface | Now | Target | Source |
| --- | --- | --- | --- |
| Admin · Knowledge files | RightPanel không gắn handler phím; Tabs không xử lý mũi tên | Not in code yet — build with the body values. Gắn `onKeyDown={event => handleTabKeyDown(event, {activation: 'manual'})}` lên TabsList của RightPanel như ChatBox; giữ nguyên chiều cao 40px và gạch chân; Home/End/mũi tên chuyển focus, Enter hoặc Space chọn tab. | [WAI-ARIA APG — tabs](https://www.w3.org/WAI/ARIA/apg/patterns/tabs/) |
| Admin · Knowledge files | RightPanel dùng div thay `TabsContent`, trigger không có aria-controls | Not in code yet — build with the body values. Render `TabsContent` có id, nối trigger bằng aria-controls và panel bằng aria-labelledby; không đổi layout hiện tại. | [WAI-ARIA APG — tabs](https://www.w3.org/WAI/ARIA/apg/patterns/tabs/) |
| Admin · Knowledge files | Tabs của kit chung | Not available — new build follows Target. Knowledge files không dùng `chatty-*`: chuyển sang Polaris `Tabs`, vì trang admin ngoài inbox giữ Polaris. | [Shopify: Built for Shopify requirements](https://shopify.dev/docs/apps/launch/built-for-shopify/requirements) |
| Classic | TrackingTab tự dựng tablist bằng button, không có tabpanel | Not available — new build follows Target. Port `chatty-tabs`, `chatty-tab` và `chatty-tab-panel` từ mục Standard; tab và panel là con light DOM để quan hệ ARIA bằng ID nằm cùng tree scope. |  |
| Admin | MessageTab trong ChatBox tự dựng tablist, không có tabpanel | Not available — new build follows Target. Port `chatty-tabs` với activation manual cho composer inbox; giữ Chat, Note, Reminder và nối panel bằng chatty-tab-panel. |  |
```


- [WAI-ARIA APG — tabs](https://www.w3.org/WAI/ARIA/apg/patterns/tabs/)
- [Shopify: Built for Shopify requirements](https://shopify.dev/docs/apps/launch/built-for-shopify/requirements)
