angular / angular/components

Side Nav - fullscreen should make the side nav full screen only when its open

Open
#17,380 4 comments 2 reactions 0 assignees View on GitHub
area: material/sidenav feature needs: discussion P3
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

#### Feature Description

The `fullscreen` api of `mat-sidenav-container` allow us to show the side nav with height set to 100% of the viewport. And this probably is the most followed way to achieve this as proposed by these answers on stack overflow:

https://stackoverflow.com/questions/37334853/cant-get-angular-material-md-sidenav-to-be-100-height
https://stackoverflow.com/questions/46666381/unable-to-set-the-height-of-a-angular-material-sidenav-to-100

`fullscreen` option sets the below css properties on `mat-sidenav-container`:

```
top: 0!important;
left: 0!important;
right: 0!important;
bottom: 0!important;
position: absolute!important;
```

As a side effect I believe this blocks the scroll events and as a result it breaks the functionality of components/directives that relies on scroll events. For example, `ngx-infinite-scroll` is one of the commonly used plugins (87k weekly downloads) that allow loading contents as soon as user reaches to the bottom of the page. When we set `fullscreen` on `mat-sidenav-container` , `ngx-infinite-scroll` no longer works. As reported here

https://stackoverflow.com/questions/50377502/angular-material-and-ngx-infinite-scroll?rq=1

and

https://github.com/orizens/ngx-infinite-scroll/issues/182

What if we apply the below styles of `fullscreen` mode **only** when the side nav is opened:

```
top: 0!important;
left: 0!important;
right: 0!important;
bottom: 0!important;
position: absolute!important;
```

This way it wont affect the other portion of the application. Because when the nav bar is open user wont be scrolling the page contents, so if the scroll events are blocked it wont be a issue.

Contributor guide

Open the contributing guide

Research direction

Start with the mat-sidenav-container fullscreen API and reproduce the reported interaction with ngx-infinite-scroll, using the linked examples and reports as context. Done means the fullscreen styles affect the container while the side nav is open, without preventing page scroll events when it is closed.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.