-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
fix(tab-button): badge is aligned in rtl #26986
Conversation
Run & review this pull request in StackBlitz Codeflow. |
The item and select diffs in Safari/Firefox appear to be correct:
The |
The expected changes look good, but I'm curious why you went the ::slotted(ion-margin-example) {
@include margin(10px, 12px, 14px, 16px);
} becomes ::slotted(ion-margin-example) {
margin-left: 16px;
margin-right: 12px;
margin-top: 10px;
margin-bottom: 14px;
}
@supports (margin-inline-start: 0) or (-webkit-margin-start: 0) {
::slotted(ion-margin-example) {
margin-left: unset;
margin-right: unset;
-webkit-margin-start: 16px;
margin-inline-start: 16px;
-webkit-margin-end: 12px;
margin-inline-end: 12px;
}
} So it would be something like this: @mixin position-horizontal($start: null, $end: null) {
@if $start == $end {
@include multi-dir() {
left: $start;
right: $end;
}
} @else {
@include ltr() {
left: $start;
right: $end;
}
@include rtl() {
left: unset;
right: unset;
left: $end;
right: $start;
}
}
@at-root {
@supports (inset-inline-start: 0) {
& {
@if $start != null {
left: unset;
}
@if $end != null {
right: unset;
}
inset-inline-start: $start;
inset-inline-end: $end;
}
}
}
}
::slotted(ion-position-example) {
@include position(10px, 12px, 14px, 16px);
} becomes ::slotted(ion-position-example) {
left: 16px;
right: 12px;
top: 10px;
bottom: 14px;
}
[dir=rtl] ::slotted(ion-position-example), :host-context([dir=rtl]) ::slotted(ion-position-example) {
left: unset;
right: unset;
left: 12px;
right: 16px;
}
@supports (inset-inline-start: 0) {
::slotted(ion-position-example) {
left: unset;
right: unset;
inset-inline-start: 16px;
inset-inline-end: 12px;
}
} Granted I didn't test this out in Ionic, so this could very much be a bad approach, but that's why I'm asking. 🙂 |
Good question! I considered it, but I didn't want to have to unset the left/right values when using |
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.
Sounds good. I'm okay with this approach since we plan to remove it with future support.
Pull request checklist
Please check if your PR fulfills the following requirements:
ionic-docs
repo, in a separate PR. See the contributing guide for details.npm run build
) was run locally and any changes were pushednpm run lint
) has passed locally and any fixes were made for failuresPull request type
Please check the type of change your PR introduces:
What is the current behavior?
Part of #17012, resolves #22739
RTL-aware mixins that do not make use of logical CSS properties rely on host-context to check the document's text direction. This CSS pseudo-class is only supported in Chromium browsers. As a result, certain RTL-aware mixins do not work in Safari and Firefox.
One of these mixins is the position mixin which uses top/right/bottom/left properties. In this particular case, the badge in ion-tab-button is not aligned correctly in RTL mode due to this issue.
What is the new behavior?
position
mixin to make use of inset-inline-start and inset-inline-end which are the logical properties forleft
andright
.Source (MD)
Before
After
Browsers that support
inset-inline
will use the logical properties. If they are not supported then it will fallback to using the oldhost-context
method.According to https://caniuse.com/?search=inset-inline, Chrome 87+ supports the logical properties. This fallback ensures that Chrome 79-86 still has RTL support through the use of
host-context
.All versions of Firefox that Ionic 7 supports also supports
inset-inline
.Safari 14.5+ supports
inset-inline
. The reported bug will persist in Safari 14.0-14.4, which is what is happening right now. 92% of iPhone users are on iOS 15-16, so I expect the impact of this lack of support to be minimal (https://developer.apple.com/support/app-store/).Does this introduce a breaking change?
Other information