Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

opened initially shows sidebar even if false #112

Closed
Ketec opened this issue Aug 4, 2017 · 15 comments
Closed

opened initially shows sidebar even if false #112

Ketec opened this issue Aug 4, 2017 · 15 comments
Labels

Comments

@Ketec
Copy link

Ketec commented Aug 4, 2017

[opened]="false"
[(opened)]="state" / public state: boolean = false;

In both cases it initially shows sidebar on page load for a moment - until change detection i assume.

If i remove the opened from attributes, it won't initiall show (and well icant show it ether).

@ebtroy
Copy link

ebtroy commented Aug 6, 2017

This is happening to me as well.

@arkon arkon self-assigned this Aug 7, 2017
@arkon arkon added the bug label Aug 7, 2017
@arkon
Copy link
Owner

arkon commented Aug 7, 2017

I can't seem to reproduce this. Are there any other options that you've used?

@Ketec
Copy link
Author

Ketec commented Aug 7, 2017

                <ng-sidebar
                    [(opened)]="settingsOpened"
                    position=right
                    [autoFocus]=false
                    [trapFocus]=false
                    [mode]="'over'"
                >

settingsOpened is false (settign it false in there still causes the bug).

@arkon
Copy link
Owner

arkon commented Aug 7, 2017

I still can't seem to reproduce the issue. Do you have some styles for the sidebar too?

@Ketec
Copy link
Author

Ketec commented Aug 9, 2017

.ng-sidebar {
    box-shadow: -4px 0px 3px -1px #e5e5e5;
    background-color: #f3f3f4 !important;
    overflow: visible !important;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
    flex-direction: column;
    z-index: 100 !important;
}

ng-sidebar-container {
    flex-basis: 100%;
    width: auto !important;
}

There is however another instance of a sidebar inside it's (using different property for opened).

<div class="content-panel-area">
	<ng-sidebar-container>
		<!--Global sidebar-->
		<ng-sidebar-container ng-sidebar-content>
			<!-- Main view/routes wrapper-->
			<div ng-sidebar-content>
				<router-outlet></router-outlet>
			</div>
			<ng-sidebar
				[opened]="opened"
				position=right
				[autoFocus]=false
				[trapFocus]=false
				[mode]="'over'"
			>
				<sidebar-content></sidebar-content>
			</ng-sidebar>
		</ng-sidebar-container>

		<!-- Settings sidebar -->
		<ng-sidebar
			[(opened)]="settingsOpened"
			position=right
			[autoFocus]=false
			[trapFocus]=false
			[mode]="'over'"
                        class="settings-module"
		>
			<settings></settings>
		</ng-sidebar>
	</ng-sidebar-container>
</div>

the settings sidebar has a style override for higher z-index.

@kotmatpockuh
Copy link

the same issue :(

@Ketec
Copy link
Author

Ketec commented Aug 22, 2017

Bit of testing and it seems like animations are to blame:

:host /deep/ .settings-module .ng-sidebar--animate[_ngcontent-c6] {
    -webkit-transition: none !important;
    transition: none !important;
}

Quick override to this and the bug is gone - but so is the animation. It seems like the animation is triggered in the beginning and in some cases (larger app, slower initial load and wider sidebar), it becomes noticeably visible.

In the code:
@Input() animate: boolean = true;
There is a line:
// Prevents an initial transition hiccup in IE (issue #59)
So i assume a similar bug.

Currently i set [animate]="initialAnimateDisable" default as false and set it enabled the first time i set opened true.

@Ketec Ketec closed this as completed Aug 22, 2017
@Ketec Ketec reopened this Aug 22, 2017
@arkon
Copy link
Owner

arkon commented Oct 9, 2017

Thanks for the investigation and suggestion, @Ketec . I've published v6.0.4 with a change based on yours.

@arkon arkon closed this as completed Oct 9, 2017
@arkon arkon removed their assignment Oct 9, 2017
arkon pushed a commit that referenced this issue Oct 9, 2017
@RezaRahmati
Copy link

RezaRahmati commented Sep 16, 2018

Same for me, is this issue solved?

On first refresh it shows the slider and hides it

slider

@arkon
Copy link
Owner

arkon commented Sep 16, 2018

Open another issue. It should be fixed though, unless you can reproduce the problem in a basic setup.

@RezaRahmati
Copy link

I found a workaround

animate = false;
  ngOnInit() {
    setTimeout(() => {
      this.animate = true;
    }, 1000);
  }

<ng-sidebar [(opened)]="sideOpen" [position]="'right'" [animate]="animate">

@ef32
Copy link

ef32 commented Oct 23, 2018

This issue seems to have resurfaced in the latest version

@arkon
Copy link
Owner

arkon commented Oct 23, 2018

There hasn't been an update in 3 months...

@jomol-aima
Copy link

jomol-aima commented Dec 13, 2019

Anybody solved this issue? I am facing this issue in my application and not able to figure it out

@lasantha57
Copy link

@RezaRahmati is right! Problem is with the [animate]="true". Either we can remove it or this workaround would work.

  animate = false;

  ngOnInit() {
    setTimeout(() => {
      this.animate = true;
    });
  }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

8 participants