Loading...

HAXcms Themes Work in Edit Mode on a Phone

RULES.md

Every HAXcms theme, bundled or a site's `custom/` theme, generated by a tool or written by hand, must stay usable while editing on a 360px wide phone, not just while viewing on a desktop. (1) If the theme makes room for the HAX tray with `:host([edit-mode]){margin:var(--hax-tray-element-align-margin, ...)}`, it must also reset that margin with `:host([edit-mode][tray-status="collapsed"]){margin:0}` and `@media (max-width:800px){:host([edit-mode]){margin:0}}`, the way `polaris-flex-theme` does. The tray is about 350px wide, so without the reset a phone page is squeezed into a sliver about 90px wide. (2) Multi-column layouts collapse to one column at the theme's mobile breakpoint (900px or 800px in sibling themes; a smaller one such as 640px is fine if the layout still fits). Grid tracks use `minmax(0,1fr)` and flex or grid children that hold content get `min-width:0`, so long words and wide HAX elements can't push a column past the viewport. (3) Display type (site titles, page titles, banners) is sized with `clamp()` and wraps with `overflow-wrap:anywhere` instead of overflowing its box. (4) Decoration (backgrounds, flames, tape, badges, cursor effects) never takes layout space from content, and motion effects pause in edit mode. (5) The skip link (`href="#contentcontainer"`) is the first thing in `render()`, and the `contentcontainer` > `slot` > `<slot>` contract stays intact. (6) Check it before calling a theme done: render it with `edit-mode` and the tray variables set at 360px, 412px and 1280px. The page must not scroll sideways (`document.documentElement.scrollWidth` equals the viewport width), the main content column must be nearly the viewport width on phones, and the desktop layout must be unchanged. Generators that make themes (such as the GeoCities Generator) should run this as an automated test over every look they produce. See `hax-theme-builder` and `hax-site-generator`. In PRAW RULES.md (scope: haxcms). Nothing enforces this yet.

Status: gap

Connects to

Links