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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

- The demo page shows what 0.2.0 added: a `<details>` dropdown in the header nav, a link that opens a closed FAQ answer, a link that selects a tab, a Share button (`command="--share"`), search results from a hidden list with a Ctrl+K shortcut, select-all checkboxes, a plain number column lined up on the right, a filter kept in the address (`name="q"`) with its highlight and "No matches" line, a remembered sort (`data-tag-remember` on the table), a confirm-password field (`data-tag-match`), help text after a password field, an image file input with thumbnails, a red Delete in the confirm dialog, and two pictures in one figure that the viewer steps through. It now loads TagBrush.css 2 (`tagbrush@2`), which styles the header dropdown, tabs, selected rows, and toggle buttons these use.

### Added
- A sticky top bar, `<header data-layout="sticky">` (TagBrush.css), has its height kept in `--tag-header-height` on `<html>`, updated when the bar changes size. TagBrush.css's scroll padding reads it (TagBrush.css's next release; it falls back to 5rem, or 7.5rem on phones), so a heading reached by a link or `#fragment` lands just below the bar, however many rows it wraps to. Measured on a 360px phone: a bar that wrapped to three rows was 142px against 120px of room.

### Fixed
- The Copy button on a `<pre>` no longer covers the code. A line too long for the block (the install line on the demo page) ran under the button, which sat over the end of the visible text ("defer" was hidden at 360px and 1280px). The `<pre>` now keeps a transparent 5rem end border for the button, instead of 5rem of end padding: its background shows through, but the code scrolls inside it, so it never passes under the button, at the start or scrolled to the end. The `<pre>` also scrolls sideways without a stylesheet.

## 0.2.0 (2026-11-12)

Behaviors for the patterns TagBrush.css gained (dropdowns from `<details>`, the phone menu), and things visitors expect on any site.
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ TagAction is the companion to [TagBrush.css](https://github.com/kovirlabs/tagbru
| `<textarea>` | Grows as you type; character counter; Ctrl+Enter or ⌘+Enter sends its form (with validation, never mid-IME) | no `rows`; `maxlength` |
| `<input type="file">` | Lists chosen files, with thumbnails of pictures; drag and drop | `multiple`; `accept="image/*"`; its `<label>` |
| `<input type="password">` | Show/Hide button | automatic |
| `<pre>` | Copy button | automatic |
| `<pre>` | Copy button (the code scrolls clear of it) | automatic |
| `<time>` | Reader's timezone; "3 hours ago" | `datetime` with a zone; `data-tag-time="relative"` |
| `<nav>`, `<a>` | `aria-current="page"`; follows the scroll in a table of contents | automatic |
| `<header data-layout="sticky">` | its height in `--tag-header-height`, which TagBrush.css's scroll padding reads, so a jumped-to heading lands below the bar | TagBrush.css's sticky bar |
| `<h2>`, `<h3>` | "#" links; generated table of contents | `id`; `<nav data-tag-toc hidden>` |
| `<img>` | Click to enlarge; step through the pictures of a figure or section | a link to an image file; a shrunk image in `<figure>` |
| `<menu>`, dropdowns | Arrow keys, Escape, click outside; a popover of links closes when one is followed | `<button aria-expanded aria-controls>`; popover menus |
Expand Down
3 changes: 2 additions & 1 deletion ai/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ Add this to `<head>` (with or without TagBrush.css, which it is designed to sit
- `<textarea>` without `rows` grows as you type. With `maxlength`, a counter shows how many characters are used: `<textarea maxlength="280"></textarea>`. The counter goes after the field's help `<small>`, if it has one. In a form, Ctrl+Enter (⌘+Enter on a Mac) sends it, with validation; keep a submit button.
- `<input type="file" multiple>` lists the chosen file names; with `accept="image/*"` it also shows a thumbnail of each picture. Files can be dropped onto any file input or its `<label>`.
- `<input type="password">` gets a Show/Hide button.
- `<pre>` gets a Copy button.
- `<pre>` gets a Copy button, in a strip at its end that the code scrolls clear of.
- `<time datetime="2026-11-06T17:00Z">Nov 6, 5 PM UTC</time>`: a time with a timezone is shown in the reader's own timezone and language.
- `<nav>`: the link to the current page gets `aria-current="page"` (unless one is already marked). In a nav whose links all point to sections of the page, the link to the section on screen gets `aria-current="true"` as you scroll.
- Sticky top bar: `<header data-layout="sticky"><nav>…</nav></header>` (TagBrush.css) has its height kept in `--tag-header-height` on `<html>`, so a heading you jump to lands just below the bar, however many rows it wraps to.
- `<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. Pictures in the same `<figure>`, or else the same `<section>`, form a set: the viewer steps through them with Previous and Next and the arrow keys.
- `<abbr title="HyperText Markup Language">HTML</abbr>`: tapping it shows the title in brackets, for touch screens.
Expand Down
3 changes: 2 additions & 1 deletion ai/claude/tagaction/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ Add this to `<head>` (with or without TagBrush.css, which it is designed to sit
- `<textarea>` without `rows` grows as you type. With `maxlength`, a counter shows how many characters are used: `<textarea maxlength="280"></textarea>`. The counter goes after the field's help `<small>`, if it has one. In a form, Ctrl+Enter (⌘+Enter on a Mac) sends it, with validation; keep a submit button.
- `<input type="file" multiple>` lists the chosen file names; with `accept="image/*"` it also shows a thumbnail of each picture. Files can be dropped onto any file input or its `<label>`.
- `<input type="password">` gets a Show/Hide button.
- `<pre>` gets a Copy button.
- `<pre>` gets a Copy button, in a strip at its end that the code scrolls clear of.
- `<time datetime="2026-11-06T17:00Z">Nov 6, 5 PM UTC</time>`: a time with a timezone is shown in the reader's own timezone and language.
- `<nav>`: the link to the current page gets `aria-current="page"` (unless one is already marked). In a nav whose links all point to sections of the page, the link to the section on screen gets `aria-current="true"` as you scroll.
- Sticky top bar: `<header data-layout="sticky"><nav>…</nav></header>` (TagBrush.css) has its height kept in `--tag-header-height` on `<html>`, so a heading you jump to lands just below the bar, however many rows it wraps to.
- `<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. Pictures in the same `<figure>`, or else the same `<section>`, form a set: the viewer steps through them with Previous and Next and the arrow keys.
- `<abbr title="HyperText Markup Language">HTML</abbr>`: tapping it shows the title in brackets, for touch screens.
Expand Down
3 changes: 2 additions & 1 deletion ai/cursor/tagaction.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ Add this to `<head>` (with or without TagBrush.css, which it is designed to sit
- `<textarea>` without `rows` grows as you type. With `maxlength`, a counter shows how many characters are used: `<textarea maxlength="280"></textarea>`. The counter goes after the field's help `<small>`, if it has one. In a form, Ctrl+Enter (⌘+Enter on a Mac) sends it, with validation; keep a submit button.
- `<input type="file" multiple>` lists the chosen file names; with `accept="image/*"` it also shows a thumbnail of each picture. Files can be dropped onto any file input or its `<label>`.
- `<input type="password">` gets a Show/Hide button.
- `<pre>` gets a Copy button.
- `<pre>` gets a Copy button, in a strip at its end that the code scrolls clear of.
- `<time datetime="2026-11-06T17:00Z">Nov 6, 5 PM UTC</time>`: a time with a timezone is shown in the reader's own timezone and language.
- `<nav>`: the link to the current page gets `aria-current="page"` (unless one is already marked). In a nav whose links all point to sections of the page, the link to the section on screen gets `aria-current="true"` as you scroll.
- Sticky top bar: `<header data-layout="sticky"><nav>…</nav></header>` (TagBrush.css) has its height kept in `--tag-header-height` on `<html>`, so a heading you jump to lands just below the bar, however many rows it wraps to.
- `<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. Pictures in the same `<figure>`, or else the same `<section>`, form a set: the viewer steps through them with Previous and Next and the arrow keys.
- `<abbr title="HyperText Markup Language">HTML</abbr>`: tapping it shows the title in brackets, for touch screens.
Expand Down
3 changes: 2 additions & 1 deletion llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ Add this to `<head>` (with or without TagBrush.css, which it is designed to sit
- `<textarea>` without `rows` grows as you type. With `maxlength`, a counter shows how many characters are used: `<textarea maxlength="280"></textarea>`. The counter goes after the field's help `<small>`, if it has one. In a form, Ctrl+Enter (⌘+Enter on a Mac) sends it, with validation; keep a submit button.
- `<input type="file" multiple>` lists the chosen file names; with `accept="image/*"` it also shows a thumbnail of each picture. Files can be dropped onto any file input or its `<label>`.
- `<input type="password">` gets a Show/Hide button.
- `<pre>` gets a Copy button.
- `<pre>` gets a Copy button, in a strip at its end that the code scrolls clear of.
- `<time datetime="2026-11-06T17:00Z">Nov 6, 5 PM UTC</time>`: a time with a timezone is shown in the reader's own timezone and language.
- `<nav>`: the link to the current page gets `aria-current="page"` (unless one is already marked). In a nav whose links all point to sections of the page, the link to the section on screen gets `aria-current="true"` as you scroll.
- Sticky top bar: `<header data-layout="sticky"><nav>…</nav></header>` (TagBrush.css) has its height kept in `--tag-header-height` on `<html>`, so a heading you jump to lands just below the bar, however many rows it wraps to.
- `<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. Pictures in the same `<figure>`, or else the same `<section>`, form a set: the viewer steps through them with Previous and Next and the arrow keys.
- `<abbr title="HyperText Markup Language">HTML</abbr>`: tapping it shows the title in brackets, for touch screens.
Expand Down
9 changes: 9 additions & 0 deletions src/behaviors/nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
// already marks one.
// - In a nav of same-page links (a table of contents), the link to the section
// you are reading gets aria-current="true" as you scroll.
// - A sticky page header (<header data-layout="sticky">, TagBrush.css's top
// bar) has its height kept in --tag-header-height on <html>, so the room
// TagBrush.css keeps above a heading you jump to fits the bar exactly,
// however many rows it wraps to.

import { each } from '../core.js';

Expand Down Expand Up @@ -43,4 +47,9 @@ export function init(root) {
if (links.length >= 2 && links.length === nav.querySelectorAll('a[href]').length) followScroll(nav, links);
else markCurrentPage(nav);
});
each(root, 'body > header[data-layout="sticky"], body > :not([class]) > header[data-layout="sticky"]', 'header-height', (header) => {
new ResizeObserver(() => {
if (header.isConnected) document.documentElement.style.setProperty('--tag-header-height', `${header.offsetHeight}px`);
}).observe(header);
});
}
5 changes: 4 additions & 1 deletion src/styles.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
// Styles for the few things TagAction adds to a page (copy buttons, sort
// buttons, anchor links, counters). In a cascade layer and :where(), so any
// page or TagBrush.css rule wins. TagBrush.css variables are used when present.
// A <pre> with a Copy button keeps a transparent 5rem end border for the
// button: the background shows through it, but the text scrolls inside it,
// so the button never covers code.

const CSS = `@layer tagaction {
:where([data-tag="code"]) { position: relative; }
:where([data-tag="code"] > pre) { padding-inline-end: 5rem; }
:where([data-tag="code"] > pre) { overflow-x: auto; border-inline-end: 5rem solid transparent; }
:where([data-tag="copy"]) { position: absolute; top: 0.4rem; right: 0.4rem; margin: 0; padding: 0.15rem 0.6rem; font-size: 0.8rem; line-height: 1.5; background: var(--color-surface, Canvas); }
:where(:has(> [data-tag="dropdown"])) { position: relative; }
:where([data-tag="dropdown"]:not([hidden])) { position: absolute; z-index: 10; top: 100%; right: 0; min-width: 12rem; margin: 0.25rem 0 0; padding: 0.5rem; display: flex; flex-direction: column; align-items: stretch; gap: 0.25rem; list-style: none; background: var(--color-surface, Canvas); border: 1px solid var(--color-border, GrayText); border-radius: var(--border-radius, 0.5rem); box-shadow: 0 8px 24px rgb(0 0 0 / 0.15); }
Expand Down
Loading
Loading