Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## Unreleased

Behaviors for the patterns TagBrush.css gained (dropdowns from `<details>`, the phone menu), and things visitors expect on any site.

- A `<details>` dropdown in the page header's nav closes on Escape, on a click outside, and when a link in it is followed; arrow keys move through its links. A `<details>` anywhere else is left alone.
- A link to something inside a closed `<details>` (an FAQ answer) opens it, on load and when the `#fragment` changes.
- A popover holding links (a phone menu) closes when one is followed, so a link to a section on the same page isn't hidden behind the panel.
- Tabs: `role="tablist"` with `role="tab"` buttons and `aria-controls` panels. TagAction shows the selected panel, links each panel to its tab, and handles the arrow keys, Home, and End. Without JavaScript every panel shows.
- A light/dark switch, remembered across visits: `<select data-tag-theme>` (Auto, Light, Dark) or a toggle `<button data-tag-theme>`, setting `data-theme` on `<html>`.
- `command="--copy"` copies a field's value or any element's text; `command="--share"` opens the share sheet for a section's link or an `<a>`, and copies the link where there is no share sheet.
- `data-tag-match="password"` keeps a confirm field invalid, with a message, until it matches.
- A list a filter box controls, written with `hidden`, is a list of search results: it shows only while something is typed, with just the matches. TagKit's MkDocs theme uses it for search by page title.
- Size: about 9 KB gzipped. The ceiling is now 15 KB: coverage matters more than bytes, as for TagBrush.css, and the size is reported in each release.

## 0.2.0 (2026-11-08)

Fixes from the family agent evaluation: `<output>` can multiply and format, and an empty table of contents stays hidden without JavaScript. Tested with TagBrush.css 1.2.0.
Expand Down
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ TagAction is the companion to [TagBrush.css](https://github.com/kovirlabs/tagbru
- **No new syntax.** It keys off native elements and attributes first, then ARIA attributes, then a few `data-tag-*` attributes. No classes, no templating, no components, no reactive state.
- **Fills gaps, doesn't replace the browser.** Native `<details>`, `<dialog>`, `popover`, and `commandfor` do their own work.
- **Works with htmx and anything else.** Content added after load is enhanced automatically.
- **Small.** One file, no dependencies, about 7 KB gzipped.
- **Small.** One file, no dependencies, about 9 KB gzipped.

## What it does

| HTML | Behavior | Hook |
| --- | --- | --- |
| `<dialog>` | A modal closes on a backdrop click. Opens from a button with no script. | native `commandfor` / `command`; `closedby` opts out |
| `<details>` | One open at a time; remembers open state | native `name`; `data-tag-remember` |
| `<table>` | Click a header to sort; filter from a search box | `<thead>`; `aria-sort`; `<input aria-controls>` |
| `<form>` | Messages under the fields; busy submit button; unsaved-changes warning | native validation; `method="post"` |
| `<details>` | One open at a time; remembers open state; opens when a link points inside it; in the header nav, a dropdown that closes on Escape, a click outside, or a chosen link | native `name`; `data-tag-remember`; `#fragment` links; `<li><details>` in a header `<nav>` |
| `<table>`, lists | Click a header to sort; filter from a search box; a list written `hidden` is search results | `<thead>`; `aria-sort`; `<input aria-controls>` |
| `<form>` | Messages under the fields; busy submit button; unsaved-changes warning; a confirm field must match | native validation; `method="post"`; `data-tag-match` |
| `<textarea>` | Grows as you type; character counter | no `rows`; `maxlength` |
| `<input type="file">` | Lists chosen files; drag and drop | `multiple`; its `<label>` |
| `<input type="password">` | Show/Hide button | automatic |
Expand All @@ -30,7 +30,10 @@ TagAction is the companion to [TagBrush.css](https://github.com/kovirlabs/tagbru
| `<nav>`, `<a>` | `aria-current="page"`; follows the scroll in a table of contents | automatic |
| `<h2>`, `<h3>` | "#" links; generated table of contents | `id`; `<nav data-tag-toc hidden>` |
| `<img>` | Click to enlarge | a link to an image file; a shrunk image in `<figure>` |
| `<menu>`, dropdowns | Arrow keys, Escape, click outside | `<button aria-expanded aria-controls>`; popover menus |
| `<menu>`, dropdowns | Arrow keys, Escape, click outside; a popover of links closes when one is followed | `<button aria-expanded aria-controls>`; popover menus |
| Tabs | Shows the selected panel; arrow keys, Home, End | `role="tablist"`, `role="tab"` with `aria-controls` |
| Theme | Light/dark switch, remembered | `<select data-tag-theme>` or `<button data-tag-theme>` |
| Copy, share | Copy any field or element; share a link or section | `<button commandfor command="--copy">`, `command="--share"` |
| `<output>` | Live value, total, or product; currency and percent formatting | native `for`; `data-tag-calc="product"`, `data-tag-format="USD"` |
| `<abbr>` | Title shown on tap | `title` |
| `<template>` | Add repeated rows | `<button commandfor command="--clone">` |
Expand Down Expand Up @@ -97,7 +100,7 @@ Current Chrome, Edge, Firefox, and Safari. Where a browser lacks `commandfor`, e

## Tested with

TagAction 0.2.0 is tested with TagBrush.css 1.2.0 (0.1.0 was tested with 1.1.0).
TagAction 0.2.0 is tested with TagBrush.css 1.2.0 (0.1.0 was tested with 1.1.0). The unreleased changes are tested with TagBrush.css 1.2.0; tabs look best with the tab styles in the next TagBrush.css release.

## Development

Expand Down
9 changes: 8 additions & 1 deletion ai/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ Add this to `<head>` (with or without TagBrush.css, which it is designed to sit
- `<h2>` and `<h3>` with an `id` get a "#" link to the section.
- Images: a link around an image that points to an image file (a URL ending in `.jpg`, `.jpeg`, `.png`, `.webp`, `.avif`, `.gif`, or `.svg`) opens it in a viewer instead of a new page: `<a href="photo-large.jpg"><img src="photo.jpg" alt="Harbor at dusk"></a>`. An image in a `<figure>` shown smaller than its real size opens in the viewer when clicked.
- `<abbr title="HyperText Markup Language">HTML</abbr>`: tapping it shows the title in brackets, for touch screens.
- `<menu>` and popover menus (`<div popover><nav><ul>…</ul></nav></div>`): arrow keys, Home, and End move between the items.
- `<menu>` and popover menus (`<div popover><nav><ul>…</ul></nav></div>`): arrow keys, Home, and End move between the items. A popover holding links (a phone menu) closes when one is followed.
- Dropdown menu in the top bar: `<li><details><summary>Services</summary><ul><li><a href="/grants">Grants</a></li></ul></details></li>` in the page header's `<nav>` closes on Escape, a click outside, or a chosen link; arrow keys move through it.
- A link to something inside a closed `<details>` opens it: link an FAQ answer with `<a href="#refunds">` and give its `<details>` (or anything in it) that id.

### Behaviors you switch on with HTML

Expand All @@ -43,6 +45,11 @@ Add this to `<head>` (with or without TagBrush.css, which it is designed to sit
- Relative time: `<time datetime="2026-11-06T17:00Z" data-tag-time="relative">Nov 6, 2026</time>` shows "3 hours ago" and keeps it up to date. The full date is in its `title`.
- Table of contents: `<nav data-tag-toc hidden></nav>` (for example in an `<aside>` beside the `<article>`) is filled with links to the `<h2>` and `<h3>` headings in `<main>` and then shown. Headings without an `id` get one. Write `hidden` so readers without JavaScript don't get an empty menu; TagAction also shows a hidden element around the nav.
- Live result: `<output for="room breakfast">` shows the sum of the numbers in the fields with those ids, or the value of a single field: `<input type="range" id="volume" min="0" max="10"><output for="volume"></output>`. A checkbox or radio counts its value only while checked. `data-tag-calc="product"` multiplies instead, leaving out unchecked checkboxes and radios, so listing every radio of a group multiplies by the chosen one: `<output for="nights standard deluxe" data-tag-calc="product" data-tag-format="USD">`. `data-tag-format` is a currency code (`USD`, `EUR`), `percent` (0.15 shows 15%), or `number`, formatted for the page's `lang`. Write the starting result inside the `<output>` for readers without JavaScript.
- Tabs: `<div role="tablist" aria-label="Install with"><button role="tab" aria-controls="npm" aria-selected="true">npm</button><button role="tab" aria-controls="cdn">CDN</button></div><section id="npm" role="tabpanel">…</section><section id="cdn" role="tabpanel">…</section>`. Without JavaScript every panel shows; TagAction shows the selected one and moves between tabs with the arrow keys, Home, and End.
- Light/dark switch, remembered across visits: `<select data-tag-theme aria-label="Color scheme" hidden><option value="">Auto</option><option value="light">Light</option><option value="dark">Dark</option></select>`, or a toggle, `<button data-tag-theme hidden>Dark mode</button>`. It sets `data-theme` on `<html>`, which TagBrush.css follows.
- Copy: `<input id="invite" value="https://example.com/join/4F7Q" readonly aria-label="Invite link"><button commandfor="invite" command="--copy" hidden>Copy</button>` copies a field's value, or the text of any other element. Share: `<section id="pricing"><h2>Pricing</h2><button commandfor="pricing" command="--share" hidden>Share</button></section>` opens the share sheet for that section's link (or an `<a>`'s address), and copies the link where there is no share sheet.
- Matching fields: `<input type="password" id="password"><input type="password" id="confirm" data-tag-match="password">` keeps the second field invalid, with a message, until the two match.
- Search results: a filter box pointing at a list written `hidden` shows the list only while something is typed, with just the matches: `<input type="search" aria-label="Search the docs" aria-controls="pages" hidden><ul id="pages" hidden><li><a href="/install">Install</a></li></ul>`.
- Repeated rows: put a `<template>` where new items should go, and point a button at it with `command="--clone"`: `<ul><li><input aria-label="Guest name" name="guest"></li><template id="guest"><li><input aria-label="Guest name" name="guest"></li></template></ul><button type="button" commandfor="guest" command="--clone" hidden>Add guest</button>`. Ids inside each copy get a number so they stay unique.

### What TagAction does not do
Expand Down
9 changes: 8 additions & 1 deletion ai/claude/tagaction/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ Add this to `<head>` (with or without TagBrush.css, which it is designed to sit
- `<h2>` and `<h3>` with an `id` get a "#" link to the section.
- Images: a link around an image that points to an image file (a URL ending in `.jpg`, `.jpeg`, `.png`, `.webp`, `.avif`, `.gif`, or `.svg`) opens it in a viewer instead of a new page: `<a href="photo-large.jpg"><img src="photo.jpg" alt="Harbor at dusk"></a>`. An image in a `<figure>` shown smaller than its real size opens in the viewer when clicked.
- `<abbr title="HyperText Markup Language">HTML</abbr>`: tapping it shows the title in brackets, for touch screens.
- `<menu>` and popover menus (`<div popover><nav><ul>…</ul></nav></div>`): arrow keys, Home, and End move between the items.
- `<menu>` and popover menus (`<div popover><nav><ul>…</ul></nav></div>`): arrow keys, Home, and End move between the items. A popover holding links (a phone menu) closes when one is followed.
- Dropdown menu in the top bar: `<li><details><summary>Services</summary><ul><li><a href="/grants">Grants</a></li></ul></details></li>` in the page header's `<nav>` closes on Escape, a click outside, or a chosen link; arrow keys move through it.
- A link to something inside a closed `<details>` opens it: link an FAQ answer with `<a href="#refunds">` and give its `<details>` (or anything in it) that id.

## Behaviors you switch on with HTML

Expand All @@ -48,6 +50,11 @@ Add this to `<head>` (with or without TagBrush.css, which it is designed to sit
- Relative time: `<time datetime="2026-11-06T17:00Z" data-tag-time="relative">Nov 6, 2026</time>` shows "3 hours ago" and keeps it up to date. The full date is in its `title`.
- Table of contents: `<nav data-tag-toc hidden></nav>` (for example in an `<aside>` beside the `<article>`) is filled with links to the `<h2>` and `<h3>` headings in `<main>` and then shown. Headings without an `id` get one. Write `hidden` so readers without JavaScript don't get an empty menu; TagAction also shows a hidden element around the nav.
- Live result: `<output for="room breakfast">` shows the sum of the numbers in the fields with those ids, or the value of a single field: `<input type="range" id="volume" min="0" max="10"><output for="volume"></output>`. A checkbox or radio counts its value only while checked. `data-tag-calc="product"` multiplies instead, leaving out unchecked checkboxes and radios, so listing every radio of a group multiplies by the chosen one: `<output for="nights standard deluxe" data-tag-calc="product" data-tag-format="USD">`. `data-tag-format` is a currency code (`USD`, `EUR`), `percent` (0.15 shows 15%), or `number`, formatted for the page's `lang`. Write the starting result inside the `<output>` for readers without JavaScript.
- Tabs: `<div role="tablist" aria-label="Install with"><button role="tab" aria-controls="npm" aria-selected="true">npm</button><button role="tab" aria-controls="cdn">CDN</button></div><section id="npm" role="tabpanel">…</section><section id="cdn" role="tabpanel">…</section>`. Without JavaScript every panel shows; TagAction shows the selected one and moves between tabs with the arrow keys, Home, and End.
- Light/dark switch, remembered across visits: `<select data-tag-theme aria-label="Color scheme" hidden><option value="">Auto</option><option value="light">Light</option><option value="dark">Dark</option></select>`, or a toggle, `<button data-tag-theme hidden>Dark mode</button>`. It sets `data-theme` on `<html>`, which TagBrush.css follows.
- Copy: `<input id="invite" value="https://example.com/join/4F7Q" readonly aria-label="Invite link"><button commandfor="invite" command="--copy" hidden>Copy</button>` copies a field's value, or the text of any other element. Share: `<section id="pricing"><h2>Pricing</h2><button commandfor="pricing" command="--share" hidden>Share</button></section>` opens the share sheet for that section's link (or an `<a>`'s address), and copies the link where there is no share sheet.
- Matching fields: `<input type="password" id="password"><input type="password" id="confirm" data-tag-match="password">` keeps the second field invalid, with a message, until the two match.
- Search results: a filter box pointing at a list written `hidden` shows the list only while something is typed, with just the matches: `<input type="search" aria-label="Search the docs" aria-controls="pages" hidden><ul id="pages" hidden><li><a href="/install">Install</a></li></ul>`.
- Repeated rows: put a `<template>` where new items should go, and point a button at it with `command="--clone"`: `<ul><li><input aria-label="Guest name" name="guest"></li><template id="guest"><li><input aria-label="Guest name" name="guest"></li></template></ul><button type="button" commandfor="guest" command="--clone" hidden>Add guest</button>`. Ids inside each copy get a number so they stay unique.

## What TagAction does not do
Expand Down
9 changes: 8 additions & 1 deletion ai/cursor/tagaction.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ Add this to `<head>` (with or without TagBrush.css, which it is designed to sit
- `<h2>` and `<h3>` with an `id` get a "#" link to the section.
- Images: a link around an image that points to an image file (a URL ending in `.jpg`, `.jpeg`, `.png`, `.webp`, `.avif`, `.gif`, or `.svg`) opens it in a viewer instead of a new page: `<a href="photo-large.jpg"><img src="photo.jpg" alt="Harbor at dusk"></a>`. An image in a `<figure>` shown smaller than its real size opens in the viewer when clicked.
- `<abbr title="HyperText Markup Language">HTML</abbr>`: tapping it shows the title in brackets, for touch screens.
- `<menu>` and popover menus (`<div popover><nav><ul>…</ul></nav></div>`): arrow keys, Home, and End move between the items.
- `<menu>` and popover menus (`<div popover><nav><ul>…</ul></nav></div>`): arrow keys, Home, and End move between the items. A popover holding links (a phone menu) closes when one is followed.
- Dropdown menu in the top bar: `<li><details><summary>Services</summary><ul><li><a href="/grants">Grants</a></li></ul></details></li>` in the page header's `<nav>` closes on Escape, a click outside, or a chosen link; arrow keys move through it.
- A link to something inside a closed `<details>` opens it: link an FAQ answer with `<a href="#refunds">` and give its `<details>` (or anything in it) that id.

## Behaviors you switch on with HTML

Expand All @@ -49,6 +51,11 @@ Add this to `<head>` (with or without TagBrush.css, which it is designed to sit
- Relative time: `<time datetime="2026-11-06T17:00Z" data-tag-time="relative">Nov 6, 2026</time>` shows "3 hours ago" and keeps it up to date. The full date is in its `title`.
- Table of contents: `<nav data-tag-toc hidden></nav>` (for example in an `<aside>` beside the `<article>`) is filled with links to the `<h2>` and `<h3>` headings in `<main>` and then shown. Headings without an `id` get one. Write `hidden` so readers without JavaScript don't get an empty menu; TagAction also shows a hidden element around the nav.
- Live result: `<output for="room breakfast">` shows the sum of the numbers in the fields with those ids, or the value of a single field: `<input type="range" id="volume" min="0" max="10"><output for="volume"></output>`. A checkbox or radio counts its value only while checked. `data-tag-calc="product"` multiplies instead, leaving out unchecked checkboxes and radios, so listing every radio of a group multiplies by the chosen one: `<output for="nights standard deluxe" data-tag-calc="product" data-tag-format="USD">`. `data-tag-format` is a currency code (`USD`, `EUR`), `percent` (0.15 shows 15%), or `number`, formatted for the page's `lang`. Write the starting result inside the `<output>` for readers without JavaScript.
- Tabs: `<div role="tablist" aria-label="Install with"><button role="tab" aria-controls="npm" aria-selected="true">npm</button><button role="tab" aria-controls="cdn">CDN</button></div><section id="npm" role="tabpanel">…</section><section id="cdn" role="tabpanel">…</section>`. Without JavaScript every panel shows; TagAction shows the selected one and moves between tabs with the arrow keys, Home, and End.
- Light/dark switch, remembered across visits: `<select data-tag-theme aria-label="Color scheme" hidden><option value="">Auto</option><option value="light">Light</option><option value="dark">Dark</option></select>`, or a toggle, `<button data-tag-theme hidden>Dark mode</button>`. It sets `data-theme` on `<html>`, which TagBrush.css follows.
- Copy: `<input id="invite" value="https://example.com/join/4F7Q" readonly aria-label="Invite link"><button commandfor="invite" command="--copy" hidden>Copy</button>` copies a field's value, or the text of any other element. Share: `<section id="pricing"><h2>Pricing</h2><button commandfor="pricing" command="--share" hidden>Share</button></section>` opens the share sheet for that section's link (or an `<a>`'s address), and copies the link where there is no share sheet.
- Matching fields: `<input type="password" id="password"><input type="password" id="confirm" data-tag-match="password">` keeps the second field invalid, with a message, until the two match.
- Search results: a filter box pointing at a list written `hidden` shows the list only while something is typed, with just the matches: `<input type="search" aria-label="Search the docs" aria-controls="pages" hidden><ul id="pages" hidden><li><a href="/install">Install</a></li></ul>`.
- Repeated rows: put a `<template>` where new items should go, and point a button at it with `command="--clone"`: `<ul><li><input aria-label="Guest name" name="guest"></li><template id="guest"><li><input aria-label="Guest name" name="guest"></li></template></ul><button type="button" commandfor="guest" command="--clone" hidden>Add guest</button>`. Ids inside each copy get a number so they stay unique.

## What TagAction does not do
Expand Down
Loading
Loading