Skip to content

Open-source AI browser agent for Chrome and Firefox (monorepo) 🧠

12.1 KB
Raw Blame
<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>Trusted click fallback fixture</title>
  <style>
    body {
      margin: 0;
      padding: 24px;
      font: 16px/1.4 sans-serif;
    }

    .row {
      box-sizing: border-box;
      width: 360px;
      min-height: 56px;
      margin: 0 0 12px;
      padding: 16px;
      border: 1px solid #bbb;
    }

    #covered-wrap {
      position: relative;
      width: 360px;
      height: 56px;
      margin-bottom: 12px;
    }

    #covered-row,
    #cover {
      position: absolute;
      inset: 0;
    }

    #cover {
      z-index: 2;
      background: rgba(255, 255, 255, 0.95);
    }

    #zero-row {
      width: 0;
      height: 0;
      min-height: 0;
      margin: 0;
      padding: 0;
      overflow: hidden;
    }

    .external-label {
      display: inline-block;
      margin: 0 12px 12px 0;
    }

    .nested-control-row {
      display: flex;
      align-items: center;
      justify-content: center;
      height: 56px;
      padding: 0;
    }

    .nested-control-row > button,
    .nested-control-row > a,
    .nested-control-row > input {
      box-sizing: border-box;
      width: 220px;
      height: 40px;
    }

    .nested-control-row > a {
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .focus-wrapper-row {
      padding: 0;
    }

    .focus-wrapper-row > div {
      box-sizing: border-box;
      width: 100%;
      min-height: 54px;
      padding: 16px;
    }

    .modal {
      display: none;
      box-sizing: border-box;
      width: 520px;
      min-height: 180px;
      padding: 24px;
      border: 2px solid #444;
      background: #fff;
    }
  </style>
</head>
<body>
  <article class="product-card" data-product-id="cola-zero-six-pack">
    <h2>Cola Zero 6-pack</h2>
    <a href="/products/cola-zero-six-pack">Product details</a>
    <div role="listitem">
      <span id="add-cola-zero-label">Add to cart</span>
      <button id="add-cola-zero" type="button" aria-labelledby="add-cola-zero-label">
        <svg aria-hidden="true" width="16" height="16"><circle cx="8" cy="8" r="6"></circle></svg>
      </button>
    </div>
  </article>
  <section id="ambiguous-context">
    <div id="ambiguous-target" class="row" role="group" tabindex="0">
      <span>Archived conversations and navigation items from many unrelated contacts appear in this broad container.</span>
      <span>This deliberately long surrounding context repeats enough descriptive page copy to make an unnamed generic
        target unsafe to click without a fresh, named accessibility target. Archived conversations and navigation
        items from many unrelated contacts appear in this broad container, alongside settings, shortcuts, status
        notices, filters, and other controls that are not the requested destination.</span>
    </div>
  </section>
  <div id="trusted-row" class="row" role="listitem" tabindex="0">Defne Sokullu Yesterday Photo</div>
  <div id="synthetic-row" class="row" role="listitem" tabindex="0">Normal synthetic row</div>
  <div id="tabindex-negative-row" class="row focus-wrapper-row" role="listitem">
    <div tabindex="-1">Generic row with tabindex minus one wrapper</div>
  </div>
  <div id="tabindex-zero-row" class="row focus-wrapper-row" role="listitem">
    <div tabindex="0">Generic row with tabindex zero wrapper</div>
  </div>
  <div id="data-action-row" class="row" role="listitem" data-action="open-chat" tabindex="0">Generic data action row</div>
  <div id="proper-name-row" class="row" role="listitem" tabindex="0">Post Malone</div>
  <div id="send-message-row" class="row" role="listitem" tabindex="0">Send message</div>
  <div id="order-lunch-row" class="row" role="listitem" tabindex="0">Order lunch</div>
  <div id="book-now-row" class="row" role="listitem" tabindex="0">Book now</div>
  <div id="install-app-row" class="row" role="listitem" tabindex="0">Install app</div>
  <div id="invite-teammate-row" class="row" role="listitem" tabindex="0">Invite teammate</div>
  <div id="nested-button-row" class="row nested-control-row" role="listitem" aria-label="Nested button row">
    <button type="button">Nested button action</button>
  </div>
  <div id="nested-link-row" class="row nested-control-row" role="listitem" aria-label="Nested link row">
    <a href="#nested-link">Nested link action</a>
  </div>
  <div id="nested-input-row" class="row nested-control-row" role="listitem" aria-label="Nested input row">
    <input type="text" aria-label="Nested input action">
  </div>
  <button id="native-button" type="button">Native button</button>
  <button id="disabled-native-button" type="button" disabled>Disabled native action</button>
  <button id="disabled-aria-button" type="button" aria-disabled="true">Disabled ARIA action</button>
  <details id="native-details" class="row">
    <summary id="native-summary">Native disclosure</summary>
    <div>Native disclosure content</div>
  </details>
  <div id="destructive-row" class="row" role="listitem" tabindex="0">Delete account</div>
  <span id="indirect-delete-label" class="external-label">Delete account indirectly</span>
  <div id="indirect-delete-row" class="row" role="listitem" tabindex="0" aria-labelledby="indirect-delete-label"></div>
  <span id="turkish-delete-label" class="external-label">Hesabı sil</span>
  <div id="turkish-delete-row" class="row" role="listitem" tabindex="0" aria-labelledby="turkish-delete-label"></div>
  <div id="stateful-row" class="row" role="treeitem" aria-expanded="false" tabindex="0">Expandable row</div>
  <div id="data-state-row" class="row" role="listitem" data-state="closed" tabindex="0">Stateful list row</div>
  <input id="native-input" type="text" value="Native input" aria-label="Native input">
  <select id="native-select" aria-label="Native select"><option>Native select</option></select>
  <div id="editable-row" class="row" role="textbox" aria-label="Editable row" contenteditable="true">Editable row</div>
  <section id="framework-composer">
    <div id="framework-editor" role="textbox" aria-label="Framework post text" contenteditable="true"></div>
    <button id="framework-post" type="button" aria-disabled="true">Framework Post</button>
  </section>
  <div id="download-row" class="row" role="listitem" data-download tabindex="0">Export report</div>
  <form>
    <div id="form-row" class="row" role="listitem" tabindex="0">Form row</div>
    <label class="external-label" for="firefox-checkbox">
      <input id="firefox-checkbox" name="compatible_apps" value="firefox" type="checkbox">
      Firefox compatibility
    </label>
    <label class="external-label" for="trusted-firefox-checkbox">
      <input id="trusted-firefox-checkbox" name="trusted_compatible_apps" value="firefox" type="checkbox">
      Trusted Firefox compatibility
    </label>
    <label class="external-label">
      <input id="android-checkbox" name="compatible_apps" value="android" type="checkbox">
      Firefox for Android compatibility
    </label>
    <label class="external-label" for="selected-channel-radio">
      <input id="selected-channel-radio" name="channel" value="stable" type="radio" checked>
      Selected channel
    </label>
    <label class="external-label" for="blocked-channel-radio">
      <input id="blocked-channel-radio" name="channel" value="blocked" type="radio">
      Blocked channel
    </label>
  </form>
  <div id="android-confirmation" class="modal">
    <h3>Firefox for Android compatibility</h3>
    <p>Did you test your extension to ensure it works as expected on Firefox for Android?</p>
    <button id="android-confirm-yes" type="button">Yes, I’ve tested my extension with Firefox for Android</button>
    <a id="android-confirm-no" href="#">No, I have not tested</a>
  </div>
  <div id="covered-wrap">
    <div id="covered-row" class="row" role="listitem" tabindex="0">Covered row</div>
    <div id="cover">Overlay</div>
  </div>
  <div id="opacity-row" class="row" role="listitem" tabindex="0">Opacity row</div>
  <div id="pointer-row" class="row" role="listitem" tabindex="0" style="pointer-events:none">Pointer disabled row</div>
  <div id="zero-row" role="listitem" tabindex="0">Zero row</div>
  <div id="grid-chat-list" role="grid" aria-label="Grid chat list" data-testid="chat-list">
    <div role="row"><div id="grid-chat-cell" class="row" role="gridcell" tabindex="-1">Grid chat row</div></div>
    <div role="row"><div id="grid-selected-cell" class="row" role="gridcell" tabindex="-1" aria-selected="true">Selected grid chat row</div></div>
  </div>
  <p id="status">idle</p>
  <p id="ambient-status">ambient-idle</p>

  <script>
    window.__trustedClickEvents = [];
    window.__gridChatEvents = [];
    window.__syntheticClickEvents = [];
    window.__trustedCheckboxEvents = [];
    window.__frameworkInputEvents = [];
    document.getElementById('framework-editor').addEventListener('input', (event) => {
      window.__frameworkInputEvents.push({ trusted: event.isTrusted, text: event.currentTarget.innerText });
      if (event.isTrusted && event.currentTarget.innerText.trim()) {
        document.getElementById('framework-post').setAttribute('aria-disabled', 'false');
      }
    });
    document.getElementById('trusted-firefox-checkbox').addEventListener('click', (event) => {
      window.__trustedCheckboxEvents.push({ trusted: event.isTrusted, checked: event.currentTarget.checked });
      if (!event.isTrusted) event.preventDefault();
    });
    let androidConfirmed = false;
    const androidCheckbox = document.getElementById('android-checkbox');
    const androidConfirmation = document.getElementById('android-confirmation');
    androidCheckbox.addEventListener('click', (event) => {
      if (androidConfirmed) return;
      event.preventDefault();
      androidConfirmation.style.display = 'block';
    });
    document.getElementById('android-confirm-yes').addEventListener('click', () => {
      androidConfirmed = true;
      androidCheckbox.checked = true;
      androidCheckbox.dispatchEvent(new Event('change', { bubbles: true }));
      androidConfirmation.style.display = 'none';
    });
    document.getElementById('android-confirm-no').addEventListener('click', (event) => {
      event.preventDefault();
      androidCheckbox.checked = false;
      androidConfirmation.style.display = 'none';
    });
    document.getElementById('blocked-channel-radio').addEventListener('click', (event) => {
      event.preventDefault();
    });
    document.getElementById('trusted-row').addEventListener('click', (event) => {
      window.__trustedClickEvents.push({ trusted: event.isTrusted, type: event.type });
      if (event.isTrusted) {
        event.currentTarget.classList.add('trusted-opened');
        event.currentTarget.setAttribute('aria-current', 'true');
        document.getElementById('status').textContent = 'trusted-opened';
      } else {
        const row = event.currentTarget;
        setTimeout(() => {
          row.classList.add('unread-update');
          row.style.setProperty('--ambient-update', '1');
          const preview = document.createElement('span');
          preview.textContent = ' New ambient preview';
          preview.className = 'ambient-preview';
          row.appendChild(preview);
          document.getElementById('ambient-status').textContent = 'unrelated-chat-churn';
        }, 40);
      }
    });
    // A grid chat list row like WhatsApp's: a real press opens it, a
    // script-dispatched click does nothing.
    for (const type of ['mousedown', 'click']) {
      document.getElementById('grid-chat-cell').addEventListener(type, (event) => {
        window.__gridChatEvents.push({ trusted: event.isTrusted, type: event.type });
        if (event.isTrusted && event.type === 'mousedown') {
          event.currentTarget.classList.add('grid-opened');
          event.currentTarget.setAttribute('aria-current', 'true');
          document.getElementById('status').textContent = 'grid-opened';
        }
      });
    }
    document.getElementById('synthetic-row').addEventListener('click', (event) => {
      window.__syntheticClickEvents.push({ trusted: event.isTrusted, type: event.type });
      event.currentTarget.classList.add('synthetic-opened');
      document.getElementById('status').textContent = 'synthetic-opened';
    });
  </script>
</body>
</html>