oddbird / oddbird/css-anchor-positioning

[BUG] `inset` not overridden correctly in fallbacks

Open
#319 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
493
Forks
18
Avg merge
12h 37m
Merged PRs (30d)
5

Description

Describe the bug
Given

 inset: auto;
 top: anchor(bottom);
 left: anchor(right);

the position-try fallback is created as:

  left:var(--anchor-15OcXs-HWJ-Q)!important;
  top:revert!important;
  bottom:var(--anchor-NFBDsMuRrZSb)!important;
  inset:auto!important;

The inset is added after the others, which cascades to override the other values. In addition, top conflicts, and should not be set.

To Reproduce
Create a target with position-try-fallbacks and inset: auto.

Expected behavior
The inset shorthand should work in combination with the other values as expected.

Screenshots
If applicable, add screenshots to help explain your problem.

Browsers tested on
Polyfill v0.5.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with a target using position-try-fallbacks and inset: auto, then trace where the position-try fallback CSS is generated. Confirm that the inset shorthand no longer overrides the other fallback values and that the conflicting top declaration is omitted.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.