Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
ba2deec
Insert position-area mapping styles into each target's own root
jpzwarte Jul 25, 2026
21caf74
Fix fetchInlineStyles
jpzwarte Jul 25, 2026
5efedde
Add example
jpzwarte Jul 27, 2026
5c19e33
Add example
jpzwarte Jul 27, 2026
d61fb36
Replace `style*=` queries with a more performant approach
jpzwarte Jul 28, 2026
4f2f36f
Simplify container handling
jpzwarte Jul 28, 2026
9c989c6
Make containers required
jpzwarte Jul 28, 2026
055cc5e
Remove unneeded fallbacks
jamesnw Aug 3, 2026
56adbe3
Documentation
jamesnw Aug 3, 2026
bc7b531
Merge branch 'main' of https://github.com/oddbird/css-anchor-position…
jamesnw Aug 3, 2026
f373402
Add AgentScan workflow
jamesnw Aug 10, 2026
99d0f65
Lint
jamesnw Aug 10, 2026
04606cd
review
jgerigmeyer Aug 12, 2026
07390d1
allow manually triggering a scan
jgerigmeyer Aug 12, 2026
74eee80
Merge pull request #458 from oddbird/agent-scan
jgerigmeyer Aug 12, 2026
647940e
Make containers optionally undefined
jgerigmeyer Aug 13, 2026
705df42
Remove generated styles from the transformCSS process
jgerigmeyer Aug 13, 2026
a8b2fef
Only write CSS to its relevant container
jgerigmeyer Aug 13, 2026
0ac7c96
add tests
jgerigmeyer Aug 13, 2026
c3a864d
Add tests, remove term reducer
jamesnw Aug 14, 2026
fe08c46
Merge branch 'main' of https://github.com/oddbird/css-anchor-position…
jamesnw Aug 14, 2026
dc5f29a
Comment
jamesnw Aug 14, 2026
5c5272f
Update comment
jamesnw Aug 14, 2026
3e0b420
Update src/fetch.ts
jgerigmeyer Aug 14, 2026
e922b94
Update tests/unit/fetch.test.ts
jgerigmeyer Aug 14, 2026
1daef9f
Merge pull request #446 from jpzwarte/fix/444-position-area-on-host
jamesnw Aug 14, 2026
354cc5c
Merge pull request #448 from jpzwarte/fix/435-shift-inline-styles
jgerigmeyer Aug 14, 2026
d502c29
Add example with scoped custom element registry
jpzwarte Aug 16, 2026
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
55 changes: 55 additions & 0 deletions .github/workflows/agentscan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: AgentScan

on:
# Do NOT add actions/checkout to this workflow: pull_request_target runs
# with write permissions, so checking out PR code would allow a malicious
# PR to run arbitrary code with access to the token.
# Only `opened` (not `reopened`): a flagged PR/issue that gets reopened
# stays open for manual review, as the flag messages promise.
# To trigger a scan manually, add the `agentscan:scan` label to any PR
# or issue (remove and re-add it to re-scan).
pull_request_target:
types:
- opened
- labeled
issues:
types:
- opened
- labeled

concurrency:
group: agentscan-${{ github.event.pull_request.number || github.event.issue.number }}
cancel-in-progress: true

jobs:
agentscan:
# On `labeled` events, only run for the manual-trigger label (the scan
# itself adds `agentscan:*` labels, which must not re-trigger it).
if: github.event.action != 'labeled' || github.event.label.name == 'agentscan:scan'
runs-on: ubuntu-latest
permissions:
pull-requests: write
issues: write
contents: read
steps:
- name: AgentScan
uses: MatteoGabriele/agentscan-action@e02ef270c024bfad3541b2a71619c3c9f20b3312 # v2.2.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
scan-issues: true
auto-close: true
trusted-author-associations: '["owner", "member", "collaborator"]'
# Only `automation` and community-flagged accounts are auto-closed
# (the action's default); `mixed` is labeled and left open.
message-mixed: |
This was flagged as potentially not having a human behind it.
If this was flagged in error, we apologize.
A maintainer will review it manually.
message-automation: |
This was flagged as potentially not having a human behind it, and so it was closed.
If this was flagged in error, we apologize.
Please reopen it and we will manually review it.
message-community-flagged: |
This was flagged as potentially not having a human behind it, and so it was closed.
If this was flagged in error, we apologize.
Please reopen it and we will manually review it.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,26 @@ following features:
containing block. To work around this, the polyfill strips any non-`auto`
inset from the target (setting `inset: auto`) and re-applies it as padding
on the wrapper, so the wrapper continues to drive positioning.
- Moving the target into the wrapper disconnects and reconnects it. If the
target is a custom element, its `connectedCallback` therefore runs more
than once, and any setup that can only happen once must be guarded — for
example, calling `attachShadow()` a second time throws. This applies to
any custom element the polyfill positions with `position-area`, including
a host positioned by a `position-area` in its own `:host` rule:

```js
class MyElement extends HTMLElement {
connectedCallback() {
if (this.shadowRoot) return;
this.attachShadow({ mode: 'open' });
// ...
}
}
```

Setting [`positionAreaContainingBlock`](#positionareacontainingblock) to
`false` (or `'auto'`, for targets that don't need the wrapper) avoids the
wrapper, and with it the reconnection.
- When the wrapper is not added, styles that resolve against the containing
block — percentage sizes, `auto` or percentage margins, percentage padding,
or `stretch`/`anchor-center` self-alignment — will not match native
Expand Down
23 changes: 23 additions & 0 deletions position-area.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,29 @@ <h2>
</div>
</section>

<section class="position-area-demo-item" id="inline-shifted">
<h2>
<a href="#inline-shifted" aria-hidden="true">🔗</a>
<code>span-left top, padding set inline ✅</code>
</h2>
<div style="position: relative" class="demo-elements">
<div class="anchor">Anchor</div>
<div class="target inline-shifted" style="padding-right: 50%">
Target with longer content
</div>
</div>
<p>
The same as the demo above, except that
<code>padding-right: 50%</code> is an inline style rather than a
stylesheet rule. Inline styles are shifted into custom properties like
the rest of the CSS, so <a href="?auto"><code>auto</code> mode</a> can
still see the percentage padding and wraps the target. Without that
shift the padding reads back as empty, the target is positioned
directly, and the padding resolves against the original containing block
instead of the <code>position-area</code> cell.
</p>
</section>

<section class="position-area-demo-item" id="nested-alignment">
<h2>
<a href="#nested-alignment" aria-hidden="true">🔗</a>
Expand Down
6 changes: 6 additions & 0 deletions public/position-area-page.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@
position-area: span-left top;
}

/* Same as `.spanleft-top`, but the containing-block-dependent padding is set
* as an inline style on the target instead. */
.target.inline-shifted {
position-area: span-left top;
}

.target.spanall-left {
position-area: span-all left;
}
Expand Down
Loading