Skip to content

fix(sidenav): not positioning correctly in rtl #12741

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

Merged
merged 1 commit into from
Sep 14, 2018
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions src/lib/sidenav/drawer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="mat-drawer-inner-container">
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a little bit worried that this wrapper might interfere with styles people have added. We might need to bump this to major, lets see how the presubmit goes though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Exactly what happened to us, maybe mention that the template changed in the changelog ?

<ng-content></ng-content>
</div>
11 changes: 11 additions & 0 deletions src/lib/sidenav/drawer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,17 @@ $mat-drawer-over-drawer-z-index: 4;
}
}

// Note that this div isn't strictly necessary on all browsers, however we need it in
// order to avoid a layout issue in Chrome. The issue is that in RTL mode the browser doesn't
// account for the sidenav's scrollbar while positioning, which ends up pushing it partially
// out of the screen. We work around the issue by having the scrollbar be on this inner container.
.mat-drawer-inner-container {
width: 100%;
height: 100%;
overflow: auto;
Copy link

@Bored-Bohr Bored-Bohr Dec 3, 2018

Choose a reason for hiding this comment

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

This overflow causes the overflow to be applied to the inner container instead of the parent mat-sidenav. It will now look like
image
if you attempt to set styles such as padding or width to the mat-sidenav element

-webkit-overflow-scrolling: touch;
}

.mat-sidenav-fixed {
position: fixed;
}
2 changes: 1 addition & 1 deletion src/lib/sidenav/drawer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export class MatDrawerContent extends CdkScrollable implements AfterContentInit
moduleId: module.id,
selector: 'mat-drawer',
exportAs: 'matDrawer',
template: '<ng-content></ng-content>',
templateUrl: 'drawer.html',
animations: [matDrawerAnimations.transformDrawer],
host: {
'class': 'mat-drawer',
Expand Down
2 changes: 1 addition & 1 deletion src/lib/sidenav/sidenav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class MatSidenavContent extends MatDrawerContent {
moduleId: module.id,
selector: 'mat-sidenav',
exportAs: 'matSidenav',
template: '<ng-content></ng-content>',
templateUrl: 'drawer.html',
animations: [matDrawerAnimations.transformDrawer],
host: {
'class': 'mat-drawer mat-sidenav',
Expand Down