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

Add RTL support #8

Merged
merged 2 commits into from
Jan 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/bootstrap4-floating-label.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ $label-top-position-md: #{- $label-height-md + $label-height-md / 2.5}; // -24px
$label-height-lg: $font-size-lg * $input-line-height-lg; // 30px
$label-top-position-lg: #{- $label-height-lg + $label-height-lg / 2.5}; // -30px + (30px / 2) = -15px

// Support for "right to left" languages
[dir='rtl'] {
%label-inside-input-rtl {
left: auto !important;
right: 0;
}
%label-above-input-rtl {
left: auto !important;
right: $input-padding-x-sm;
}
}

@mixin label-common {
// Breaks flexbox :-/
// ["An absolutely-positioned child of a flex container does not participate in flex layout"](https://stackoverflow.com/a/41033582/990356)
Expand All @@ -76,6 +88,7 @@ $label-top-position-lg: #{- $label-height-lg + $label-height-lg / 2.5}; // -30px
// see https://github.com/mui-org/material-ui/blob/v3.3.2/packages/material-ui/src/NativeSelect/NativeSelect.js#L77
// See ["the mouse event go "through" the element and target whatever is "underneath" that element instead"](https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events)
pointer-events: none;
@extend %label-above-input-rtl;
}

@mixin label-inside-input-sm {
Expand Down