Skip to content
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

feat(rtl): optimize the new mixins for smaller bundle, ltr seperation #11635

Merged
merged 87 commits into from
Jun 6, 2017

Conversation

AmitMY
Copy link
Contributor

@AmitMY AmitMY commented May 12, 2017

Short description of what this resolves:

  • Mixins were not very efficient, creating 4 properties when there can be 1 most of the time.
  • LTR rules override some RTL rules, or RTL auto/initial override RTL itself, fixed
  • No direction can only be set for LTR

Changes proposed in this pull request:

  • Better mixins generation (smaller bundle size)
  • Better RTL support
  • Choose a direction! $app-direction: null is the default, which means all available directions. $app-direction: ltr or $app-direction: rtl make sure the app only support one direction (reducing bundle from 687kb to 575kb, using everything default)

Ionic Version: 3.x

Fixes preview: http://ionic-snapshot-go.appspot.com/ionic2/snapshots/d4t/hhp/chrome_400x800

Closes: #11805 #11914

AmitMY added 30 commits April 8, 2017 00:16
replaced item-right with item-end
# Conflicts:
#	src/components/toggle/toggle.md.scss
add support for old variable names
# Conflicts:
#	src/components/button/button-icon.scss
…-optimize

# Conflicts:
#	src/components/tabs/tabs.wp.scss
@@ -97,16 +97,15 @@ $action-sheet-ios-button-cancel-font-weight: 600 !default;

.action-sheet-ios .action-sheet-group {
@include border-radius($action-sheet-ios-border-radius);
@include margin(null, null, $action-sheet-ios-group-margin-bottom - 2, null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to use the mixin for margin-bottom, margin-top, padding-bottom, or padding-top? These shouldn't be affected by RTL, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory, you are correct, and that is what I've done before. In practice no.

span {
    margin-top: 1px;
}
[dir=rtl] span {
    margin: 5px;
}

Gives the span margin: 5px, because of specificity.

[dir=rtl] span {
    margin-top: 1px;
}
[dir=rtl] span {
    margin: 5px;
}

Gives the span margin: 1px 5px 5px 5px, because of specificity. (which is the wanted behavior)

Don't worry, it gets super squashed at the end

@@ -20,10 +20,6 @@ $split-pane-side-max-width: 28% !default;
contain: strict;
}

[dir="rtl"] .split-pane {
flex-direction: row-reverse;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because it is not the correct behavior.. I checked on an iPad, in the mail app, the menu part is on the right on rtl, and left on ltr

@@ -82,6 +82,15 @@

// ---------------------------------------------------------------------------------

// Minimum breakpoint width. Null for the smallest (first) breakpoint.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why were these moved?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably incorrect to do this in this PR, but the order of the mixins is giving IDE errors, as we call an undefined method

@mixin multi-dir() {
@if $app-direction == null {
$root: #{&};
@at-root [dir="ltr"], [dir="rtl"] {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to specify dir if the rule applies to both? Also will this work without @at-root being in front of [dir="rtl"]?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of CSS specificity rules, otherwise it overrides stuff. And no, the @at-root seems to be a must

@mixin ltr() {
@if $app-direction == null {
$root: #{&};
@at-root [dir="ltr"] {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not crazy about forcing a dir in the app.

@brandyscarney brandyscarney merged commit f0c6948 into ionic-team:master Jun 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ionic 3.0.0 side menu issue in RTL
2 participants