`state` drops interactive elements (button/input/select) inside <table> cells — not indexable or clickable
- Dominant language
- JavaScript
- Stars
- 29.3k
- Forks
- 2.9k
- Avg merge
- 15h 36m
- Merged PRs (30d)
- 70
Description
### Version
opencli 1.8.5
### Problem
Interactive elements (``, ``, ``) rendered **inside `` cells** are dropped from `state` output. They get no `[N]` ref, so none of the first-class commands can locate them:
- `click ` — no ref exists
- `click --text 'Details'` — 0 matches
- `click --role button` — 0 matches
Only `` links inside cells survive (serialized as clickable). This makes CRM / admin data-grids (where each row has action buttons like "Details", "Follow up", inline `` dropdowns, etc.) impossible to drive with first-class commands — the only workaround is `eval` DOM clicking, which defeats the purpose of a structured UI agent.
### Root cause
In `dist/src/browser/dom-snapshot.js`:
1. **`serializeTable(...)`** flattens each ``/`` to `cell.textContent` and only wraps `a[href]` into a clickable markdown link. Cell-level `` / `` / `` are emitted as plain text with no ref.
2. In the `walk(...)` `` branch, after emitting the markdown table it does `return false;` (comment: *tables usually non-interactive*), so the walker **never descends into the table subtree** — meaning no `data-opencli-ref` is ever assigned to any element inside the table.
### Repro
1. Render an AntD / rc-table with an action button per row, e.g. `Details` in the last cell.
2. `opencli browser state` → the row shows `Details` as plain text, no `[N]`.
3. `opencli browser click --text 'Details'` / `--role button` → 0 matches.
4. `opencli browser get html --selector '.ant-table-row'` → confirms it's a real `…Details`, not an ``.
### Suggested fix
- In `serializeTable`, assign a `[N]` ref to interactive cell children (`button` / `input` / `select` / `[role=button]` …), the same way `a[href]` is handled; **or**
- Don't unconditionally `return false` on the `` branch — let the walker descend so normal `isInteractive` detection assigns refs to in-cell controls.
Contributor guide
Research direction
Read dist/src/browser/dom-snapshot.js, focusing on serializeTable and the table branch in walk, then reproduce the issue with an in-cell button, input, or select. Verify the fix with browser state and click --text or click --role, and use get html --selector '.ant-table-row' to confirm the controls remain real interactive elements with usable refs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100