Transformed media queries leave gaps between breakpoints

Open Beginner friendly
#1,793 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
javascript
Domain
frontend

Research direction

Start by locating the media-query transformation exercised by the provided reproduction and compare its generated upper-bound condition with the expected output. Add a regression test using the supplied input and output, then verify that the interval before 64rem is continuous and excludes 64rem.

Written by the indexing model from the issue text.

Description

bug
Describe the issue

Take this create call:

const styles = stylex.create({
  foo: {
    gridColumn: {
      default: '1 / 2',
      '@media (width >= 48rem)': '1 / 3',
      '@media (width >= 64rem)': '1 / -1',
    },
  },
});

It is now transformed at compile time to:

const styles = stylex.create({
  foo: {
    gridColumn: {
      default: '1 / 2',
      '@media (width >= 48rem) and (width <= 63.99rem) ': '1 / 3',
      '@media (width >= 64rem)': '1 / -1',
    },
  },
});
Expected behavior

It should be transformed to:

const styles = stylex.create({
  foo: {
    gridColumn: {
      default: '1 / 2',
      '@media (width >= 48rem) and (width < 64rem) ': '1 / 3',
      '@media (width >= 64rem)': '1 / -1',
    },
  },
});
Steps to reproduce
const styles = stylex.create({
  foo: {
    gridColumn: {
      default: '1 / 2',
      '@media (width >= 48rem)': '1 / 3',
      '@media (width >= 64rem)': '1 / -1',
    },
  },
});
Test case

Input:

const styles = stylex.create({
  foo: {
    gridColumn: {
      default: '1 / 2',
      '@media (width >= 48rem)': '1 / 3',
      '@media (width >= 64rem)': '1 / -1',
    },
  },
});

Output:

const styles = stylex.create({
  foo: {
    gridColumn: {
      default: '1 / 2',
      '@media (width >= 48rem) and (width < 64rem) ': '1 / 3',
      '@media (width >= 64rem)': '1 / -1',
    },
  },
});
Additional comments

No response

Dominant language
JavaScript
Stars
10.3k
Forks
485
Avg merge
3d 19h
Merged PRs (30d)
17

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.

More from facebook/stylex

All issues in facebook/stylex

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.