Skip to content

Commit

Permalink
Fix order-first and order-last for Firefox (#16266)
Browse files Browse the repository at this point in the history
This PR fixes an issue where `order-last` doesn't work as expected in
Firefox.

The implementation of `order-last`, looks like this: 
```css
.order-last {
  order: calc(infinity);
}
```

Which is valid CSS, and `calc(infinity)` is even valid in Firefox. You
can use this in other properties such as `border-radius`:
```css
.rounded-full {
  border-radius: calc(infinity * 1px);
}
```

While this works, in properties like `order` it just doesn't work.

Fixes: #16165
  • Loading branch information
RobinMalfait authored Feb 5, 2025
1 parent 3b61277 commit 82d486a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Ensure that the `containers` JS theme key is added to the `--container-*` namespace ([#16169](https://github.com/tailwindlabs/tailwindcss/pull/16169))
- Fix missing `@keyframes` definition ([#16237](https://github.com/tailwindlabs/tailwindcss/pull/16237))
- Vite: Skip parsing stylesheets with the `?commonjs-proxy` flag ([#16238](https://github.com/tailwindlabs/tailwindcss/pull/16238))
- Fix `order-first` and `order-last` for Firefox ([#16266](https://github.com/tailwindlabs/tailwindcss/pull/16266))

## [4.0.3] - 2025-02-01

Expand Down
4 changes: 2 additions & 2 deletions packages/tailwindcss/src/utilities.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1053,11 +1053,11 @@ test('order', async () => {
}
.order-first {
order: calc(-infinity);
order: -9999;
}
.order-last {
order: calc(infinity);
order: 9999;
}
.order-none {
Expand Down
4 changes: 2 additions & 2 deletions packages/tailwindcss/src/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,8 @@ export function createUtilities(theme: Theme) {
/**
* @css `order`
*/
staticUtility('order-first', [['order', 'calc(-infinity)']])
staticUtility('order-last', [['order', 'calc(infinity)']])
staticUtility('order-first', [['order', '-9999']])
staticUtility('order-last', [['order', '9999']])
staticUtility('order-none', [['order', '0']])
functionalUtility('order', {
supportsNegative: true,
Expand Down

0 comments on commit 82d486a

Please sign in to comment.