CSS sibling-index() and sibling-count() functions

Open
#1,460 3 comments 39 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
65/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
css
Domain
testing

Research direction

The issue is about fixing WPT failures for sibling-index() and sibling-count() CSS functions. Start by examining the test results at https://wpt.fyi/results/css/css-values/tree-counting/ to identify specific failing tests. Review the CSS Values and Units Level 5 specification at https://drafts.csswg.org/css-values-5/#tree-counting to understand the expected behavior. Look at the existing test files in the web-platform-tests repository under css/css-values/tree-counting/ to understand the test structure and determine what needs to be corrected. Done looks like all tests pass.

Written by the indexing model from the issue text.

Description

focus-area-proposal
Description

sibling-index() and sibling-count() can be used as integers in CSS property values to style elements based on their position among its siblings, or the total number of siblings respectively. These functions can be used directly as integer values, but more interestingly inside calc() expressions.

Example:

li {
  margin-left: calc(10px * sibling-index());
}

Example use cases for this are staggered animations setting the animation- or transition-delay based on the sibling position, and building a radial menu.

These functions are shipped in all engines, but all have wpt failures.

Specification

https://drafts.csswg.org/css-values-5/#tree-counting

web-feature

https://web-platform-dx.github.io/web-features-explorer/features/sibling-count/

Test Links

https://wpt.fyi/results/css/css-values/tree-counting/

Additional Signals

No response

Dominant language
JavaScript
Stars
591
Forks
39
Avg merge
3h 8m
Merged PRs (30d)
2

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from web-platform-tests/interop

All issues in web-platform-tests/interop

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.