On this page

Error + retry

Cho khách thử lại câu trả lời lỗi bằng một alert và một nút Try again.

Copy page as MarkdownRead Markdown ↗

Key rules

  • AI Mode: một lỗi answer dùng AnswerError với một nút retry min-height 44px; caller nối onRetry.
  • Classic: AnswerError render trong viewportFooter của WidgetV2Messages; nút retry cũng min-height 44px.
  • Component chỉ sở hữu thông báo và nút; việc giữ message hay composer thuộc caller.
On this page

Use when / Avoid

Dùng khi một lượt trả lời AI thất bại và khách có thể thử lại ngay. Các lỗi khác (hội thoại đã kết thúc) có markup riêng.

Use instead

Component Use when
AnswerError Lượt trả lời AI thất bại và có callback retry.
span Hội thoại đã kết thúc: alert riêng và nút Start new chat dùng class chatty-retry-button.

Entry points

Surface Owner
AI Mode Caller trong ChatThread
Classic Caller WidgetV2Messages, tải qua ChatMessagesArea

Flow

Surface Step Trigger UI shown Component Copy + i18n key Timing
AI Mode Lỗi view.showError Alert và nút retry AnswerError Something went wrong while preparing the answer. / Try again Caller quyết định lúc render
AI Mode Retry Click nút Caller gọi chatActions.retryLast AnswerError Try again Caller async
Classic Lỗi failedAiTurn có và không loginRequired Alert và nút retry trong footer AnswerError Something went wrong while preparing the answer. / Try again Caller quyết định lúc render
Classic Retry Click nút Gọi retryAiTurn AnswerError Try again Caller async

Edge cases

Surface Case Behaviour
AI Mode Hội thoại đã bị xoá failedTurn.kind là deleted: span alert cùng nút Start new chat thay cho AnswerError
Classic Cần đăng nhập Không render AnswerError khi loginRequired có giá trị
Classic Test AI của merchant Retry gọi retryTestAiTurn thay vì retryAiTurn

Live preview

Classic: bubble thu gọn là fixture từ chatty-icon-button; Current: FloatButtonWidget, chưa có element. Bag và menu (…) ở header: N/A trong preview.

AI Mode: SignIn, EmailContinue, Reset và Bag ở header: N/A trong preview.

Standard

Standard
LightDarkDesktopMobile

Thread Standard dùng fixture cục bộ.

Show code
chatty-pattern-error-retry.element.jsWrap code linesCopy
import '@avada/chatty-ui/tokens/tokens.css';
import {html} from 'lit';
import {IconClose, IconMessage} from '@avada/chatty-ui/elements/icon-glyphs.js';
import '@avada/chatty-ui/elements/surface.js';
import '@avada/chatty-ui/elements/avatar.js';
import '@avada/chatty-ui/elements/badge.js';
import '@avada/chatty-ui/elements/icon-button.js';
import '@avada/chatty-ui/elements/launcher.js';
import '@avada/chatty-ui/elements/button.js';
import {sameGroup} from '@avada/chatty-ui/behaviors/messages.js';

// Reference viewport: 1280 × 900 desktop, 390 × 900 mobile.
const sizes = {
  classic: {width: 400, height: 700},
  'ai-mode': {width: 820, height: 657},
  admin: {width: 527, height: 842}
};
const question = {
  id: 'question',
  senderType: 'customer',
  text: 'Can you help me?',
  createdAt: '2026-01-15T10:00:00Z'
};

/** Viewport-relative sizing survives the initial hidden iframe layout. */
function widgetSize(surface) {
  const mode = new URLSearchParams(location.search).get('mobile');
  const isMobile = mode === null ? innerWidth < 900 : mode === 'true';
  const width = `min(${sizes[surface].width}px, max(0px, 100vw - 40px))`;
  const height = isMobile
    ? `min(${surface === 'admin' ? 848 : 888}px, round(down, calc(${width} * 2.2), 1px))`
    : `${sizes[surface].height}px`;
  return {...sizes[surface], height, mobile: isMobile};
}

/** Local immutable message state with real subscriptions for live previews. */
function fixtureStore(initial) {
  let state = {messages: initial};
  const listeners = new Set();
  return {
    getState: () => state,
    subscribe(listener) {
      listeners.add(listener);
      return () => listeners.delete(listener);
    },
    setMessages(messages) {
      state = {messages};
      listeners.forEach(listener => listener());
    }
  };
}

/** Appends the viewer message without replacing the existing conversation. */
function appendViewer(store, surface, text) {
  const message = {
    id: `viewer-${store.getState().messages.length}`,
    senderType: surface === 'admin' ? 'agent' : 'customer',
    senderMeta: {name: surface === 'admin' ? 'Alex' : 'You'},
    text,
    createdAt: new Date().toISOString()
  };
  store.setMessages([...store.getState().messages, message]);
}

/**
 * One shell owns surface sizing, header, thread and composer for every pattern.
 * @param {string} surface
 * @param {Object} store
 * @param {Object} strings
 * @param {Object} content
 * @param {Function} renderMessage
 * @param {Function} onSend
 * @param {Object} registry
 * @param {boolean} composerHidden
 * @param {string} title
 * @param {Object} headerStart
 * @param {Object} headerActions
 * @param {boolean} sheet
 * @param {string | null} status
 * @returns {Object}
 */
function patternShell({
  surface,
  store,
  strings = {header: 'Store assistant', message: 'Message', send: 'Send'},
  content,
  renderMessage,
  onSend,
  registry,
  title,
  headerStart,
  headerActions,
  status = 'online',
  sheet = false,
  composerHidden = false
}) {
  const size = widgetSize(surface);
  const mobileSheet = sheet && size.mobile;
  if (mobileSheet) {
    size.width = 'none';
    size.height = 'calc(100dvh - 12px)';
  }
  const toggle = (event, closed) => {
    const frame = event.currentTarget.closest('[data-pattern-frame]');
    const panel = frame.querySelector('chatty-surface');
    const launcher = frame.querySelector('[data-pattern-launcher]');
    panel.hidden = closed;
    frame.dataset.closed = String(closed);
    const background = frame.querySelector('[data-sheet-page]');
    if (background) background.inert = !closed && surface === 'ai-mode';
    launcher.hidden = !closed;
    if (closed) {
      launcher.style.insetBlockEnd = `${Math.max(surface === 'ai-mode' ? 40 : 16, frame.getBoundingClientRect().bottom - innerHeight + 20)}px`;
      launcher.focus({preventScroll: true});
    } else {
      const composer = panel.querySelector('chatty-composer');
      const input = !composer.hidden
        ? composer.renderRoot.querySelector('textarea')
        : (panel
            .querySelector('chatty-contact-form:not([hidden])')
            ?.renderRoot.querySelector('chatty-text-field') ??
          panel.querySelector('form chatty-text-field') ??
          panel.querySelector('[data-welcome-invitation]:not([hidden]) chatty-button') ??
          panel
            .querySelector('chatty-pre-chat:not([hidden])')
            ?.renderRoot.querySelector('chatty-button'));
      input?.focus({preventScroll: true});
    }
  };
  const sender = message => {
    const content = renderMessage?.(message) ?? {};
    const messages = store.getState().messages;
    const previous = messages[messages.indexOf(message) - 1];
    if (message.senderType !== 'bot' || sameGroup(message, previous)) return content;
    return {
      ...content,
      sender: html`<span style="display:inline-flex;align-items:center;gap:6px"
        ><chatty-avatar size="sm" label="Assistant">A</chatty-avatar
        >${content.sender ?? message.senderName ?? message.senderMeta?.name ?? 'Assistant'}</span
      >`
    };
  };
  return html`<style>
      [data-pattern-frame] {
        display: flex;
        position: relative;
        justify-content: center;
        inline-size: 100%;
        min-inline-size: 0;
      }
      [data-pattern-frame='classic'] {
        justify-content: flex-end;
      }
      [data-pattern-frame] chatty-surface::part(header) {
        padding: 0;
      }
      [data-pattern-frame='classic'] chatty-surface::part(header),
      [data-pattern-frame='ai-mode'] chatty-surface::part(header) {
        border-bottom-width: 0;
      }
      [data-pattern-frame] [hidden] {
        display: none !important;
      }
      [data-pattern-header] {
        display: flex;
        align-items: center;
        gap: 10px;
        box-sizing: border-box;
        min-inline-size: 0;
        block-size: 52px;
        padding: 0 16px;
      }
      [data-pattern-frame='classic'] [data-pattern-header] {
        block-size: 56px;
        background: var(--chatty-color-accent);
        color: var(--chatty-color-on-accent);
      }
      [data-pattern-frame='classic'] [data-pattern-header] chatty-icon-button {
        --chatty-color-border-focus: var(--chatty-color-on-accent);
      }
      [data-pattern-frame='admin'] [data-pattern-header] {
        block-size: 68px;
        padding: 8px 12px;
      }
      [data-pattern-header] chatty-avatar {
        --chatty-avatar-size: 32px;
      }
      [data-pattern-frame='classic'] [data-pattern-header] chatty-avatar {
        --chatty-avatar-background: #fff;
      }
      [data-pattern-frame='classic'] [data-pattern-header] chatty-avatar::part(base) {
        color: #303030;
        border: 1px solid #767676;
      }
      [data-pattern-actions] {
        display: flex;
        align-items: center;
        gap: 8px;
      }
      [data-pattern-title] {
        flex: 1;
        min-inline-size: 0;
        display: flex;
        flex-direction: column;
      }
      [data-pattern-frame='admin'] [data-pattern-title] {
        gap: 4px;
      }
      [data-pattern-frame='admin'] [data-pattern-title] strong {
        display: flex;
        align-items: center;
        min-block-size: 28px;
        font: var(--p-font-weight-semibold, 650) var(--p-text-heading-md-font-size, 14px) /
          var(--p-text-heading-md-font-line-height, 20px) var(--p-font-family-sans, system-ui);
      }
      [data-pattern-title] strong {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      [data-pattern-header] chatty-icon-button {
        --chatty-icon-button-size: 32px;
        --chatty-icon-button-color: currentColor;
      }
      @media (max-width: 899px), (pointer: coarse) {
        [data-pattern-header] chatty-icon-button {
          --chatty-icon-button-size: 44px;
        }
      }
      [data-pattern-launcher] {
        position: absolute;
        inset-inline-end: 0;
        inset-block-end: 0;
      }
      [data-pattern-frame='ai-mode'] [data-pattern-launcher] {
        inset-inline-end: auto;
        inset-inline-start: 50%;
        transform: translateX(-50%);
      }
      [data-pattern-frame='classic'] [data-pattern-launcher] {
        --chatty-icon-button-size: 56px;
        border-radius: 50%;
        background: var(--chatty-color-accent);
        --chatty-icon-button-color: var(--chatty-color-on-accent);
      }
      [data-sheet-mobile='true'] {
        position: fixed;
        inset: 0;
        inline-size: 100vw;
      }
      [data-sheet-mobile='true'] chatty-surface::part(base) {
        border-radius: 16px 16px 0 0;
      }
      [data-sheet-mobile='true'] chatty-surface {
        position: relative;
        z-index: 2;
        margin-block-start: 12px;
      }
      [data-sheet-page],
      [data-sheet-scrim] {
        position: absolute;
        inset: 0;
        box-sizing: border-box;
      }
      [data-sheet-page] {
        padding: 20px;
        background: var(--chatty-color-bg-surface);
        color: var(--chatty-color-text);
      }
      [data-sheet-scrim] {
        z-index: 1;
        border: 0;
        background: rgb(0 0 0 / 40%);
        animation: sheet-scrim 400ms ease;
      }
      [data-sheet-mobile='true'][data-closed='true'] [data-sheet-scrim] {
        display: none;
      }
      [data-sheet-mobile='true'] [data-pattern-launcher] {
        z-index: 3;
      }
      @keyframes sheet-scrim {
        from {
          opacity: 0;
        }
        to {
          opacity: 1;
        }
      }
      @media (prefers-reduced-motion: reduce) {
        [data-sheet-scrim] {
          animation: none;
        }
      }
    </style>
    <div
      data-pattern-frame=${surface}
      data-sheet-mobile=${String(mobileSheet)}
      data-closed="false"
      style=${`block-size:calc(${size.height} + ${mobileSheet ? 12 : 0}px)`}
    >
      ${
        mobileSheet
          ? html`<div data-sheet-page .inert=${surface === 'ai-mode'}>
                <p>Example storefront</p>
                <chatty-button
                  variant="secondary"
                  type="button"
                  @click=${event => {
                    event.currentTarget.textContent = 'Products opened';
                  }}
                >
                  Browse products
                </chatty-button>
              </div>
              ${surface === 'ai-mode' ? html`<button type="button" data-sheet-scrim tabindex="-1" aria-label="Close chat background" @click=${event => toggle(event, true)}></button>` : ''}`
          : ''
      }
      <chatty-surface
        data-chatty-surface=${surface}
        data-chatty-theme=${surface === 'admin' ? 'light' : (document.documentElement.dataset.chattyTheme ?? document.documentElement.dataset.theme ?? 'light')}
        style=${`inline-size:100%;max-inline-size:${mobileSheet ? 'none' : `${size.width}px`};--chatty-surface-height:${size.height}`}
        .store=${store}
        .registry=${registry ?? null}
        viewer-type=${surface === 'admin' ? 'agent' : 'customer'}
        .selfTypes=${surface === 'admin' ? ['agent', 'bot'] : null}
        .renderMessage=${sender}
      >
        <div slot="header" data-pattern-header>
          ${headerStart ?? ''}
          ${surface === 'admin' ? '' : html`<chatty-avatar label="Store" .status=${status}>S</chatty-avatar>`}
          <span data-pattern-title
            ><strong
              >${title ?? (surface === 'admin' ? 'Customer conversation' : strings.header)}</strong
            >${surface === 'admin' ? html`<chatty-badge size="sm" variant="secondary" style="align-self:flex-start">Customer</chatty-badge>` : status == null ? '' : html`<small data-pattern-status>${status === 'online' ? 'Open' : 'Closed'}</small>`}</span
          >
          <span data-pattern-actions>${headerActions ?? ''}</span>
          ${
            surface === 'admin'
              ? ''
              : html`<chatty-icon-button label="Close panel" @click=${event => toggle(event, true)}
                  >${IconClose()}</chatty-icon-button
                >`
          }
        </div>
        <chatty-thread .strings=${{bot: 'Assistant', ...strings}}></chatty-thread>${content ?? ''}
        <chatty-composer
          slot="footer"
          ?hidden=${composerHidden}
          .label=${strings.message}
          .sendLabel=${strings.send}
          @chatty-send=${event => {
            appendViewer(store, surface, event.detail.text);
            if (onSend) onSend(event.detail.text, event.currentTarget);
            else if (surface !== 'admin')
              store.setMessages([
                ...store.getState().messages,
                {
                  id: `fixture-${store.getState().messages.length}`,
                  senderType: 'bot',
                  text: `You asked: “${event.detail.text}”. I can help with that.`,
                  hasEventTime: false
                }
              ]);
          }}
        ></chatty-composer> </chatty-surface
      >${
        surface === 'admin'
          ? ''
          : surface === 'ai-mode'
            ? html`<chatty-launcher
                data-pattern-launcher
                hidden
                label="Open chat"
                @chatty-open=${event => toggle(event, false)}
                >${IconMessage({size: 20, slot: 'icon'})}Ask a question</chatty-launcher
              >`
            : html`<chatty-icon-button
                data-pattern-launcher
                hidden
                size="lg"
                label="Open chat"
                @click=${event => toggle(event, false)}
                >${IconMessage({size: 24})}</chatty-icon-button
              >`
      }
    </div>`;
}

import {createBlockRegistry} from '@avada/chatty-ui/behaviors/block-registry.js';
import '@avada/chatty-ui/elements/chatty-block-answer-error.js';
export function Standard({surface}) {
  const registry = createBlockRegistry({'answer-error': 'chatty-block-answer-error'});
  const store = fixtureStore([
    question,
    ...(surface === 'ai-mode'
      ? [{id: 'retry-answer', senderType: 'bot', blocks: [{type: 'answer-error'}]}]
      : [])
  ]);
  const retry = event => {
    const container = event.currentTarget;
    const error = event.composedPath().find(node => node.localName === 'chatty-answer-error');
    error.loading = true;
    const finish = async () => {
      const answer = {id: 'retry-answer', senderType: 'bot', text: 'Your order is on its way.'};
      store.setMessages(
        surface === 'ai-mode'
          ? store.getState().messages.map(m => (m.id === answer.id ? answer : m))
          : [...store.getState().messages, answer]
      );
      if (surface === 'classic') error.parentElement.remove();
      await new Promise(requestAnimationFrame);
      const thread = container.querySelector('chatty-thread');
      await thread.updateComplete;
      const row = [...thread.shadowRoot.querySelectorAll('chatty-message')].find(
        row => row.messageId === answer.id
      );
      await row.updateComplete;
      row.focus();
    };
    if (matchMedia('(prefers-reduced-motion: reduce)').matches) finish();
    else setTimeout(finish, 450);
  };
  return html`<div style="inline-size:100%;min-inline-size:0" @chatty-retry=${retry}>
    ${patternShell({surface, store, registry, content: surface === 'classic' ? html`<div slot="footer" style="margin-block-end:var(--chatty-space-200)"><chatty-answer-error></chatty-answer-error></div>` : ''})}
  </div>`;
}

Retry là request fixture; lịch sử được giữ, không gọi AI. AI Mode đặt alert tại vị trí câu trả lời trong thread; Classic đặt ở footer. Sau retry focus vào tin trả lời mới. Deleted → Start new chat và loginRequired: N/A trong preview.

Current

AI Mode

Current (React), being replaced
LightDarkDesktopMobile

AnswerError thật theo CSS AI Mode; Try again chỉ xác nhận callback cục bộ, không gọi AI.

Show code
error-retry.jsxWrap code linesCopy
import React, {useState} from 'react';
import {AnswerError} from '@avada/chatty-ui/canonical/AnswerError.jsx';

export function Retry({surface}) {
  const [retried, setRetried] = useState(false);
  return (
    <div className={surface === 'classic' ? 'Avada-Faqs__ChatMessages-Container--v2' : undefined}>
      <AnswerError t={text => text} onRetry={() => setRetried(true)} />
      {retried && <p role="status">Retry requested locally.</p>}
    </div>
  );
}

Import / element

AnswerError

Component / element Import / file Scope root
AnswerError @avada/chatty-ui/canonical/AnswerError.jsx .chatty-ai-mode

Anatomy

AnswerError

Part Element
1 Container div có role="alert".
2 span chứa thông báo lỗi.
3 Native buttonchatty-retry-button: icon svg rồi nhãn Try again.

Placement / order

AnswerError

Context Order
ChatThread AnswerError nằm sau failed turn trong chatty-chat-failed-row, hoặc render riêng khi view.showError, trước ContinueWithAIButton.
Component Message ở trên, nút retry ở dưới trong flex column; component không tạo composer hay danh sách message.

Props

AnswerError

Prop Type Values Default Notes
t Function Hàm dịch nhận cụm tiếng Anh Bắt buộc Dịch cả thông báo lỗi và nhãn nút.
onRetry Function Callback của caller Bắt buộc Gắn vào onClick của nút retry.

Sizes

AnswerError

Size Height Padding Gap Radius Font role (px/rem) Hit target Breakpoint / mechanism
Retry button min-height: 44px 12px 6px trong nút 999px button-label: 14pxDerived(14px = type(button-label, desktop, size)) / 18pxDerived(18px = type(button-label, desktop, line)) → 17pxDerived(17px = type(button-label, mobile, size)) / 24pxDerived(24px = type(button-label, mobile, line)), weight 500 44px (min-height) Cỡ chữ mobile theo type role; storefront đổi tại 899px
Message Theo nội dung 0 8px giữa message và nút Không có body-large: 17pxDerived(17px = type(body-large, desktop, size)) / 24pxDerived(24px = type(body-large, desktop, line)) → 19pxDerived(19px = type(body-large, mobile, size)) / 26pxDerived(26px = type(body-large, mobile, line)), weight 400 Không tương tác Cỡ chữ mobile theo type role; storefront đổi tại 899px

Tokens

AnswerError

Part Token Light Dark
Message --chatty-contact-muted #6b6b6b #a3a3a3
Retry text --chatty-contact-fg #1f1f1f #ececec
Retry hover fill --chatty-contact-bg rgba(255, 255, 255, 0.92) rgba(40, 40, 40, 0.92)
Retry ring --chatty-contact-line rgba(0, 0, 0, 0.1) rgba(255, 255, 255, 0.12)

States

AnswerError

State Trigger Visual change (values) ARIA/attribute
Default render Viền inset 1px --chatty-contact-line; nền trong suốt Không có
Hover pointer ::before nền --chatty-contact-bg Không thêm ARIA
Active pointer down scale(0.97) Không thêm ARIA
Focus-visible keyboard outline 2px solid currentColor; offset 2px Native focus
Forced colors forced-colors: active Viền 1px solid ButtonText Không thêm ARIA
Alert Component mount Message màu --chatty-contact-muted role="alert"

Behaviour

AnswerError

Interaction Result
Retry Click gọi onRetry; component không tự đổi state hay ẩn mình.
Keyboard Native button nhận Enter và Space.
Retry action Failed turn gọi chatActions.retryFailedTurn; lỗi chung gọi chatActions.retryLast.

Copy

AnswerError

String i18n key Where
Something went wrong while preparing the answer. Cùng cụm tiếng Anh Message qua t
Try again Try again Nhãn nút qua t
Copy tiếng Anh Qua helper t Caller truyền t vào component

Source

AnswerError

File Evidence
API và markup
CSS và type role
Type role

Classic

Current (React), being replaced
LightDarkDesktopMobile

AnswerError thật trong container Classic; callback cục bộ.

Show code
error-retry.jsxWrap code linesCopy
import React, {useState} from 'react';
import {AnswerError} from '@avada/chatty-ui/canonical/AnswerError.jsx';

export function Retry({surface}) {
  const [retried, setRetried] = useState(false);
  return (
    <div className={surface === 'classic' ? 'Avada-Faqs__ChatMessages-Container--v2' : undefined}>
      <AnswerError t={text => text} onRetry={() => setRetried(true)} />
      {retried && <p role="status">Retry requested locally.</p>}
    </div>
  );
}

Import / element

AnswerError

Component / element Import / file Scope root
AnswerError @avada/chatty-ui/canonical/AnswerError.jsx .Avada-Faqs__ChatMessages-Container--v2

Anatomy

AnswerError

Part Element
1 Container div có role="alert".
2 span chứa thông báo lỗi.
3 Native buttonchatty-retry-button: icon svg rồi nhãn Try again.

Placement / order

AnswerError

Context Order
WidgetV2Messages AnswerError là phần tử đầu trong viewportFooter, chỉ khi failedAiTurn có và không cần đăng nhập, trước nhánh contact prompt.
Component Message ở trên, nút retry ở dưới trong flex column; component không tạo composer hay danh sách message.

Props

AnswerError

Prop Type Values Default Notes
t Function Hàm dịch nhận cụm tiếng Anh Bắt buộc Dịch cả thông báo lỗi và nhãn nút.
onRetry Function Callback của caller Bắt buộc Gắn vào onClick của nút retry.

Sizes

AnswerError

Size Height Padding Gap Radius Font role (px/rem) Hit target Breakpoint / mechanism
Retry button min-height: 44px 12px 6px trong nút 999px button-label: 14pxDerived(14px = type(button-label, desktop, size)) / 18pxDerived(18px = type(button-label, desktop, line)) → 17pxDerived(17px = type(button-label, mobile, size)) / 24pxDerived(24px = type(button-label, mobile, line)), weight 500 44px (min-height) Cỡ chữ mobile theo type role; storefront đổi tại 899px
Message Theo nội dung 0 8px giữa message và nút Không có body-large: 17pxDerived(17px = type(body-large, desktop, size)) / 24pxDerived(24px = type(body-large, desktop, line)) → 19pxDerived(19px = type(body-large, mobile, size)) / 26pxDerived(26px = type(body-large, mobile, line)), weight 400 Không tương tác Cỡ chữ mobile theo type role; storefront đổi tại 899px

Tokens

AnswerError

Part Token Light Dark
Message --chatty-contact-muted #6b6b6b (fallback) #a3a3a3
Retry text --chatty-contact-fg #1f1f1f (fallback) #ececec
Retry hover fill --chatty-contact-bg #f2f2f2 (fallback) #262626
Retry ring --chatty-contact-line #e3e3e3 (fallback) #2e2e2e

States

AnswerError

State Trigger Visual change (values) ARIA/attribute
Default render Viền inset 1px --chatty-contact-line; nền trong suốt Không có
Hover pointer ::before nền --chatty-contact-bg Không thêm ARIA
Active pointer down scale(0.97) Không thêm ARIA
Focus-visible keyboard outline 2px solid currentColor; offset 2px Native focus
Forced colors forced-colors: active Viền 1px solid ButtonText Không thêm ARIA
Alert Component mount Message màu --chatty-contact-muted role="alert"

Behaviour

AnswerError

Interaction Result
Retry Click gọi onRetry; component không tự đổi state hay ẩn mình.
Keyboard Native button nhận Enter và Space.
Retry action Test AI của merchant gọi retryTestAiTurn; còn lại gọi retryAiTurn.

Copy

AnswerError

String i18n key Where
Something went wrong while preparing the answer. Cùng cụm tiếng Anh Message qua t
Try again Try again Nhãn nút qua t
Copy tiếng Anh Qua i18n rồi i18nChat Caller dịch theo ngôn ngữ phát hiện của conversation

Source

AnswerError

File Evidence
API và markup
CSS và type role
Type role

Do / Don't

Accessibility

Surface Role / name Keyboard / focus Live region Contrast pair / ratio
AI Mode role="alert" container; button có tên từ nhãn Try again Native button; focus ring outline 2px solid currentColor, offset 2px; component không tự chuyển focus sau retry role="alert" thông báo ngay khi mount Không nêu tỉ lệ AI Mode: nền dưới câu lỗi do biến contact-bg quyết định và không dòng nguồn nào chứng minh nền thật
Classic role="alert" container; button có tên từ nhãn Try again Native button; focus ring outline 2px solid currentColor, offset 2px; component không tự chuyển focus sau retry role="alert" thông báo ngay khi mount Không nêu tỉ lệ Classic: nền dưới câu lỗi không có dòng nguồn chứng minh