Skip to content

fix(elements): accept <glyph-camera> alias as scene's parent#4

Merged
apresmoi merged 1 commit into
mainfrom
fix/scene-accepts-glyph-camera-alias
May 23, 2026
Merged

fix(elements): accept <glyph-camera> alias as scene's parent#4
apresmoi merged 1 commit into
mainfrom
fix/scene-accepts-glyph-camera-alias

Conversation

@apresmoi
Copy link
Copy Markdown
Owner

Problem

The HTML usage from the landing/README snippets (and the new /api/html doc) fails at runtime:

```html
<glyph-camera rot-x="0.4">
...

```

```
Uncaught Error: glyphcss: must be placed inside a or .
```

`elements.ts` registers `` as a subclass of `GlyphOrthographicCameraElement`, but `GlyphSceneElement._findCameraAncestor` walks the ancestor chain comparing `tagName` against only `glyph-perspective-camera` / `glyph-orthographic-camera`. The alias subclass keeps its own `glyph-camera` tag name, so the check misses it.

Fix

  • Add `glyph-camera` to the allowed tag list in `_findCameraAncestor`.
  • Update the error message to mention the alias.
  • New test: scene mounts inside `` without throwing.

Test plan

  • `pnpm --filter glyphcss test` — 174/174 passing
  • `pnpm build` — packages + website both green
  • Manual: paste the HTML snippet from README into a sandbox after next publish; no console error

@apresmoi apresmoi merged commit e9a7a72 into main May 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant