Skip to content

Web UI: full keyboard navigation in play.html - #108972

Merged
alexey-milovidov merged 7 commits into
masterfrom
play-database-panel-arrow-nav
Jul 1, 2026
Merged

alexey-milovidov merged 7 commits into
masterfrom
play-database-panel-arrow-nav

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Jun 30, 2026 •

Copy link
Copy Markdown
Member

A pass over the Web UI (play.html) to make it fully keyboard-navigable.

  • Database panel: Up/Down arrow keys move focus between the rows (databases and their expanded tables); the panel icon can be toggled with Space or Enter (previously only Enter followed the link, Space scrolled the page).
  • Table info balloon: when a table row is focused via the keyboard, its info balloon (size, rows, engine) is shown and stays glued to the row across scrolls. Right enters the balloon's links; inside it Up/Down move between links, Left returns to the row, and Enter/Space activate the focused link.
  • Result table: focusing the table (via Tab) and pressing an arrow key selects the first data cell so arrow navigation can begin; a focus ring is shown for keyboard focus only.
  • Toolbar: the copy and download icon buttons and the theme switcher are now in the Tab order and operable with Enter/Space, and a :focus-visible outline is shown on the toolbar buttons.
  • Download menu: opening it moves focus to the format selection, and Tab/Shift+Tab flow as a contiguous group right after the download button (download → format → [other format] → Download); leaving either end or pressing Escape closes the menu.

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Web UI (play.html): full keyboard navigation — arrow-key navigation in the database panel and result table, keyboard access to the toolbar buttons, theme switcher, and download menu, and visible focus outlines.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

🤖 Generated with Claude Code

Improve keyboard accessibility of the database panel in `play.html`:

- Up/Down arrow keys now move focus between the buttons inside the panel
  (databases and their expanded tables), mirroring the existing
  Tab/Shift+Tab navigation but staying within the panel.
- The database panel icon is an `<a>` element, which the browser activates
  with Enter (following the link) but not with Space. Both keys now toggle
  the panel from the keyboard once the icon is focused via Tab, instead of
  scrolling the page or navigating away.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [c8f829e]

Summary: ✅


AI Review

Summary

This PR makes the Web UI in programs/server/play.html keyboard-navigable across the database panel, table-info balloons, result-table cells, toolbar controls, theme switcher, and download menu. I verified the current code against the prior review threads and the final PR diff; the earlier issues are addressed, and I did not find new correctness or user-facing blockers in the changed surface.

Missing context / blind spots
  • ⚠️ I did not run an interactive browser or assistive-technology pass in this environment; the review is based on static code tracing, PR discussion, and the author's manual verification notes.
Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Jun 30, 2026
Extend keyboard navigation in the database panel of `play.html`:

- When a table row is focused via keyboard navigation, its info balloon
  (size, rows, engine) is now shown and positioned, just like on hover.
  The balloon follows the row across scrolls instead of being hidden.
- The Right arrow key moves focus into the balloon's links; inside the
  balloon Up/Down move between links, Left returns to the row, and
  Enter/Space activate the focused link.

The balloon positioning logic is factored into a shared `positionTableBalloon`
function used by hover, focus, and the scroll handler.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Comment thread programs/server/play.html Resolved
Make the result table usable from the keyboard in `play.html`. The table is
already focusable (`tabindex="0"`), but tabbing to it did nothing visible and
the arrow keys were inert until a cell was clicked.

- When the focused table has no selected cell, the first arrow key now selects
  the first data cell, so the user can Tab to the table, navigate cells with the
  arrows, then Tab on to the next element.
- A focus ring is shown via `:host(:focus-visible)` for keyboard focus only, so
  clicking a cell (which programmatically focuses the table) does not draw a ring
  around the whole table.

The cell-selection logic is factored into a shared `_selectCell` method.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Comment thread programs/server/play.html Resolved
Make the toolbar controls in `play.html` fully keyboard-accessible:

- The copy and download icon "buttons" (clickable `<div>`s) and the theme
  switcher are now in the Tab navigation sequence (`tabindex="0"`,
  `role="button"`) and can be activated with Enter/Space.
- A focus ring is shown for keyboard focus only, via `:focus-visible`, on the
  real `<button>`s (Run, Run all, Download) and the icon buttons. The global
  rule that strips the default outline previously hid the focus location.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Comment thread programs/server/play.html Resolved
The download dropdown in `play.html` lives at the end of the DOM (so it can be
positioned without being clipped), which put its format `<select>`, the "other
format" input, and the Download button at the very end of the tab order, far
from the download button that opens them.

- Opening the menu now moves focus to the format selection.
- Tab/Shift+Tab flow as a contiguous group right after the download button:
  download button -> format select -> [other format] -> Download. Leaving
  either end closes the menu, and Escape closes it too.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@alexey-milovidov alexey-milovidov changed the title Web UI: keyboard navigation in the database panel Web UI: full keyboard navigation in play.html Jun 30, 2026
Address the AI review on PR #108972:

- Result table arrow navigation: `_handleKeyDown` mixed coordinate systems.
  `table` is the row's parent, i.e. the `<tbody>`, so `table.rows` is indexed
  within the section, but `row.rowIndex` is table-wide and counts the header
  row. From the first data row (`rowIndex == 1`), `ArrowDown` read
  `tbody.rows[2]` (skipping the second row) and `ArrowUp` read `tbody.rows[0]`
  (staying on the same row). Use `row.sectionRowIndex` so both sides share the
  same coordinate system.

- Focused-row scroll: the branch that keeps the keyboard-focused table balloon
  glued to its row bypassed `hideTableBalloons` and so never set
  `suppress-balloons`. A different table button scrolled under a stationary
  cursor could then reveal its balloon at an unset position via the CSS
  `:hover` rule (`mouseenter` does not fire without mouse movement). Set
  `suppress-balloons` on the focused branch too, and add a CSS rule exempting
  `.table:focus-within .table-addendum` from suppression (placed after the
  suppress rule so it wins the specificity tie) so the focused balloon stays
  visible even when the cursor is over the focused row.

Verified by manual keyboard navigation of the database panel (focused-row
scroll with the mouse stationary over another row) and the result table
(ArrowUp/ArrowDown from the first selected data cell with at least three rows).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

Pushed 456242e9529 addressing the AI review’s two Majors (verdict ⚠️ Request changes):

  1. Result table arrow navigation (play.html:2292) — _handleKeyDown mixed coordinate systems: table is the row’s <tbody> (section-local rows), but row.rowIndex is table-wide and counts the header. From the first data row ArrowDown skipped the second row (tbody.rows[2]) and ArrowUp stayed put (tbody.rows[0]). Switched the vertical index to row.sectionRowIndex so both sides are section-local; the existing row_index < 0 guard now correctly stops ArrowUp at the first row.

  2. Focused-row scroll balloon (play.html:3001) — the branch keeping the keyboard-focused balloon glued to its row bypassed hideTableBalloons and never set suppress-balloons, so a different row scrolled under a stationary cursor could reveal its balloon at an unset position via the :hover rule. Now the focused branch also sets suppress-balloons, with a new CSS rule body.suppress-balloons .table:focus-within .table-addendum { opacity: 1; pointer-events: auto; } (after the suppress rule, winning the specificity tie) so the focused balloon stays visible even when the cursor is over the focused row.

Verified by manual keyboard navigation of both paths and node --check on the extracted script. CI was green before this commit (0 failures); re-running on the new head.

@alexey-milovidov

Copy link
Copy Markdown
Member Author

CI status on head `456242e9529`: AI Review ✅ Approve, 0 unresolved review threads, MERGEABLE.

The sole red is Stateless tests (amd_asan_ubsan, distributed plan, parallel, 2/2) → 04204_global_in_join_max_rows_to_transfer_103333, failing with:

Code: 102. DB::Exception: Unexpected packet from server 127.0.0.2:9000 (expected TablesStatusResponse, got ProfileInfo): While executing Remote. (UNEXPECTED_PACKET_FROM_SERVER)

This is the known distributed TablesStatusResponse/ProfileInfo connection-desync flake (#93018), with an in-flight fix in #108854. The harness reran the test 24/24 green and reported it as not reproducible. It is categorically unrelated to this change: play.html is client-side browser code for the Web UI and cannot affect server-side distributed query execution.

No re-merge: MERGEABLE with no conflicts and merge-base is from today (<1d), so the change is not stale. Ready to merge once CI finishes.

…-arrow-nav

Resolve the conflict in `programs/server/play.html` between this branch's
keyboard-navigation work and master's Web UI changes that landed in the same
area (`#108891` table count, `#108941` horizontal-scroll fix).

Both branches independently extracted the result-table cell-selection logic
into a `_selectCell` method, so the merge left two definitions. Keep master's
`_selectCell` (it additionally focuses the cell with `td.focus({ preventScroll:
true })` and manages a roving `tabindex`, which fixes the horizontal-scroll
reset from `#108941`) and drop this branch's duplicate, which was a strict
subset. The result-table keydown handler is attached to the host element and
reads `_current_selected_cell`, so master's per-cell focus composes correctly
with the arrow-key navigation added here. At the arrow-move call site, keep
master's `cell.removeAttribute('tabindex')` before `_selectCell(new_cell)` to
maintain the roving tabindex.

All of master's additions (`.database-table-count`, `td:focus { outline: none }`,
the table-count feature in `loadTables`/`loadDatabases`) and all of this
branch's features (database-panel arrow navigation, focused-row balloon,
toolbar/theme keyboard access, download-menu tab sequence) are preserved.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

Merged master into the branch and resolved the conflict in programs/server/play.html (pushed 456242e9529..c8f829ee72c). The PR is now MERGEABLE.

The conflict was in the result-table cell-selection code: both this branch and master (via #108891 table count and #108941 horizontal-scroll fix) independently extracted the selection logic into a _selectCell method, so the merge produced two definitions. Resolution:

  • Kept master’s _selectCell — it additionally focuses the cell (td.focus({ preventScroll: true })) and manages a roving tabindex, which is the Fix horizontal scroll reset in Web UI when clicking a link in a table cell #108941 horizontal-scroll-reset fix — and dropped this branch’s duplicate, which was a strict subset. The result-table keydown handler is attached to the host element and reads _current_selected_cell (not document.activeElement), so master’s per-cell focus composes correctly with the arrow-key navigation added here.
  • At the arrow-move call site, kept master’s cell.removeAttribute(tabindex) before _selectCell(new_cell) to maintain the roving tabindex.
  • All of master’s additions (.database-table-count, td:focus { outline: none }, the table-count feature in loadTables/loadDatabases) and all of this branch’s features (database-panel arrow navigation, focused-row balloon, toolbar/theme keyboard access, download-menu tab sequence) are preserved. Verified node --check on the extracted script.

The two reds on the previous head are known, unrelated server-side flakes (this change is client-side browser code and cannot affect them):

Fresh CI is running on c8f829ee72c.

@alexey-milovidov

Copy link
Copy Markdown
Member Author

CI status on head c8f829ee72c: AI Review ✅ Approve, 0 unresolved review threads, Style check and all Stateless/Stress/Unit jobs green.

The sole red is Upgrade check (amd_release) → Error message in clickhouse-server.log, from a background MutatePlainMergeTreeTask retrying a throwIf mutation:

Code: 395. DB::Exception: Value passed to 'throwIf' function is non-zero: while executing
'FUNCTION if(1_UInt8, _CAST(plus(x, throwIf(1_UInt8)), 'UInt64'), x) -> ...'.
(FUNCTION_THROW_IF_VALUE_IS_NON_ZERO)

This is unrelated to the change — the PR is HTML-only (programs/server/play.html, +235/−14) and cannot influence a background mutation. It is a pervasive upgrade-check flake: the same Error message in clickhouse-server.log / FUNCTION_THROW_IF_VALUE_IS_NON_ZERO failure on Upgrade check (amd_release) has hit 44 distinct PRs in the last 7 days (per CIDB), including unrelated ones and the sibling play.html PR #108957.

Re-triggered the failed Upgrade check (amd_release) job (workflow run 28490078716); the cached green jobs are unaffected. It should pass on retry and clear Mergeable Check.

@alexey-milovidov

Copy link
Copy Markdown
Member Author

CI status on head c8f829ee72c: public CI is green (153 SUCCESS / 20 SKIP / 0 fail), AI Review ✅ Approve, 0 unresolved review threads, Style check and all Stateless/Stress/Unit jobs green.

The one red is CH Inc sync, which flipped to tests failed at 09:56Z on the private sync PR #62792 (merges and builds fine). All three failures are known, unrelated flakes — this PR changes only programs/server/play.html (a static Web UI asset embedded in the server binary), so no C++ stateless/integration test loads or executes it:

Re-triggered the failed private-sync jobs (cached passing jobs untouched); CH Inc sync should clear once the reruns pass.

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

@alexey-milovidov alexey-milovidov self-assigned this Jul 1, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Jul 1, 2026
Merged via the queue into master with commit ad8ec50 Jul 1, 2026
343 of 344 checks passed
@alexey-milovidov
alexey-milovidov deleted the play-database-panel-arrow-nav branch July 1, 2026 21:05
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 1, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
Address the AI review on PR ClickHouse#108972:

- Result table arrow navigation: `_handleKeyDown` mixed coordinate systems.
  `table` is the row's parent, i.e. the `<tbody>`, so `table.rows` is indexed
  within the section, but `row.rowIndex` is table-wide and counts the header
  row. From the first data row (`rowIndex == 1`), `ArrowDown` read
  `tbody.rows[2]` (skipping the second row) and `ArrowUp` read `tbody.rows[0]`
  (staying on the same row). Use `row.sectionRowIndex` so both sides share the
  same coordinate system.

- Focused-row scroll: the branch that keeps the keyboard-focused table balloon
  glued to its row bypassed `hideTableBalloons` and so never set
  `suppress-balloons`. A different table button scrolled under a stationary
  cursor could then reveal its balloon at an unset position via the CSS
  `:hover` rule (`mouseenter` does not fire without mouse movement). Set
  `suppress-balloons` on the focused branch too, and add a CSS rule exempting
  `.table:focus-within .table-addendum` from suppression (placed after the
  suppress rule so it wins the specificity tie) so the focused balloon stays
  visible even when the cursor is over the focused row.

Verified by manual keyboard navigation of the database panel (focused-row
scroll with the mouse stationary over another row) and the result table
(ArrowUp/ArrowDown from the first selected data cell with at least three rows).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…nel-arrow-nav

Web UI: full keyboard navigation in play.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-improvement Pull request with some product improvements pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants