oddbird / oddbird/css-anchor-positioning
`elements` option should find inline styles on descendent elements
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 493
- Forks
- 18
- Avg merge
- 12h 37m
- Merged PRs (30d)
- 5
Description
Is your feature request related to how this polyfill works? Please describe.
Given this HTML
<div id="wrapper">
<div id="anchor" style="anchor-name: --a">A</div>
<div id="target" style="position-anchor: --a">A</div>
</div>
and calling:
polyfill({elements: [wrapper], excludeInlineStyles: true})
Inline styles on #anchor and #target are not polyfilled. It would be useful to not have to pass each individual element, but instead just the wrapper.
Describe the solution you'd like
Adjust the polyfill so that if an element is passed, it AND its entire subtree are evaluated for inline anchor styles.
Describe alternatives you've considered
We could make this opt in, perhaps with a includeChildInlineStyles or an alternate to elements, but I think it's unlikely that people will want to not polyfill children.
Additional context
Codepen Repro
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the polyfill({elements: [wrapper], excludeInlineStyles: true}) entry point and reproduce the behavior with the linked CodePen example. Trace how the supplied elements are evaluated for inline anchor styles, then verify that the wrapper and its entire subtree are handled while excludeInlineStyles remains enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100