-
Notifications
You must be signed in to change notification settings - Fork 0
Optimize header layout performance with flexbox mixins #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: header-layout-optimization-pre
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -92,3 +92,40 @@ | |||||||||||||||||||||||||||||||
| -moz-user-select: none; | ||||||||||||||||||||||||||||||||
| -ms-user-select: none; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| // --------------------------------------------------- | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| //Flexbox | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| @mixin flexbox() { | ||||||||||||||||||||||||||||||||
| display: -webkit-box; | ||||||||||||||||||||||||||||||||
| display: -moz-box; | ||||||||||||||||||||||||||||||||
| display: -ms-flexbox; | ||||||||||||||||||||||||||||||||
| display: -webkit-flex; | ||||||||||||||||||||||||||||||||
| display: flex; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| @mixin inline-flex() { | ||||||||||||||||||||||||||||||||
| display: -webkit-inline-box; | ||||||||||||||||||||||||||||||||
| display: -webkit-inline-flex; | ||||||||||||||||||||||||||||||||
| display: -moz-inline-box; | ||||||||||||||||||||||||||||||||
| display: -ms-inline-flexbox; | ||||||||||||||||||||||||||||||||
| display: inline-flex; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| @mixin align-items($alignment) { | ||||||||||||||||||||||||||||||||
| -webkit-box-align: $alignment; | ||||||||||||||||||||||||||||||||
| -webkit-align-items: $alignment; | ||||||||||||||||||||||||||||||||
| -ms-flex-align: $alignment; | ||||||||||||||||||||||||||||||||
| -ms-align-items: $alignment; | ||||||||||||||||||||||||||||||||
| align-items:$alignment; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
Comment on lines
+117
to
+124
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Remove non-existent
- -ms-flex-align: $alignment;
- -ms-align-items: $alignment;
+ -ms-flex-align: $alignment;📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
| @mixin order($val) { | ||||||||||||||||||||||||||||||||
| -webkit-box-ordinal-group: $val; | ||||||||||||||||||||||||||||||||
| -moz-box-ordinal-group: $val; | ||||||||||||||||||||||||||||||||
| -ms-flex-order: $val; | ||||||||||||||||||||||||||||||||
| -webkit-order: $val; | ||||||||||||||||||||||||||||||||
| order: $val; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
Comment on lines
+125
to
+131
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent ❓ Verification inconclusiveAccount for the 1-based value required by Old WebKit expects If you rely on - -webkit-box-ordinal-group: $val;
+ // +1 to map zero-based order to WebKit’s one-based model
+ -webkit-box-ordinal-group: $val + 1;(Or document that Adjust Legacy WebKit’s • File: @mixin order($val) {
- -webkit-box-ordinal-group: $val;
+ // +1 to map zero-based order to WebKit’s one-based model
+ -webkit-box-ordinal-group: $val + 1;
-moz-box-ordinal-group: $val;
-ms-flex-order: $val;
-webkit-order: $val;
order: $val;
}If you’d rather avoid this adjustment, update your docs to require 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Mixed floats inside new flex container can break layout
.contentsis now a flex container, yet several direct children (.login-button,.icons,.valign-helper) still rely onfloat. Floats are taken out of normal flex flow, so expected alignment/ordering may fail (especially when wrapping).Consider dropping
floaton those items and rely solely on flexbox:🏁 Script executed:
Length of output: 2389
Remove floats and legacy alignment hacks from
.contentschildren.contentsis now a flex container (@include flexbox()/align-items: center), but its direct children still use floats or the old inline‐block vertical-align hack. Floated items are taken out of the flex flow (and the inline-block hack is redundant), which can lead to unexpected ordering or wrapping issues.Please update app/assets/stylesheets/common/base/header.scss as follows:
• Lines 42–47 (
.login-button, button.sign-up-button):float: left;and let flexbox handle horizontal placement.• Lines 53–56 (
.icons):float: left;to keep it in the flex flow.• Lines 21–24 (
.valign-helper):align-items: centeron.contentsalready vertically centers its children.Example diff:
🤖 Prompt for AI Agents