feat: implement CSS order property for flex and grid items#919
Open
jacquesg wants to merge 1 commit intoDioxusLabs:mainfrom
Open
feat: implement CSS order property for flex and grid items#919jacquesg wants to merge 1 commit intoDioxusLabs:mainfrom
jacquesg wants to merge 1 commit intoDioxusLabs:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
Implement the CSS
orderproperty for flex and grid items, as defined in CSS Display Module Level 3 §3.This allows users to control the visual ordering of flex and grid children independently of their source (DOM) order, which is a commonly expected CSS feature that taffy was missing.
Context
The CSS
orderproperty is an integer (default0) that controls:Items with lower
ordervalues are laid out first. Items with equalordervalues preserve their source order (stable sort).Changes
order: i32field toStyle(gated behindflexboxorgridfeatures)order()method to bothFlexboxItemStyleandGridItemStyletraits (defaults to0for backwards compatibility)orderand reassign visual indicesorderbefore auto-placement, assign visual order before track sizingorderfield toGridItemto carry visual order through to final positioningFeedback wanted
The
orderproperty is defined once in CSS Display Level 3 but applies to both flex and grid contexts. I addedorder()to bothFlexboxItemStyleandGridItemStyletraits separately(each defaulting to
0) rather than pulling it intoCoreStyle. This avoids a larger trait refactor while keeping backwards compatibility for custom style implementations. Open to feedback on whether a shared trait approach would be preferred.