@@ -8,6 +8,7 @@ import { tracked } from '@glimmer/tracking';
88import { action } from '@ember/object' ;
99import { registerDestructor } from '@ember/destroyable' ;
1010import type Owner from '@ember/owner' ;
11+ import { modifier } from 'ember-modifier' ;
1112
1213import { hdsBreakpoints } from '@hashicorp/design-system-components/utils/hds-breakpoints' ;
1314
@@ -49,6 +50,17 @@ export default class HdsAppSideNav extends Component<HdsAppSideNavSignature> {
4950 } ) ;
5051 }
5152
53+ private _setUpBodyElement = modifier ( ( ) => {
54+ this . _body = document . body ;
55+ // Store the initial `overflow` value of `<body>` so we can reset to it
56+ this . _bodyInitialOverflowValue =
57+ this . _body . style . getPropertyValue ( 'overflow' ) ;
58+ } ) ;
59+
60+ private _setUpNavWrapperBody = modifier ( ( element : HTMLElement ) => {
61+ this . _navWrapperBody = element ;
62+ } ) ;
63+
5264 addEventListeners ( ) : void {
5365 // eslint-disable-next-line @typescript-eslint/unbound-method
5466 document . addEventListener ( 'keydown' , this . escapePress , true ) ;
@@ -183,19 +195,6 @@ export default class HdsAppSideNav extends Component<HdsAppSideNavSignature> {
183195 }
184196 }
185197
186- @action
187- didInsert ( ) : void {
188- this . _body = document . body ;
189- // Store the initial `overflow` value of `<body>` so we can reset to it
190- this . _bodyInitialOverflowValue =
191- this . _body . style . getPropertyValue ( 'overflow' ) ;
192- }
193-
194- @action
195- didInsertNavWrapperBody ( element : HTMLElement ) : void {
196- this . _navWrapperBody = element ;
197- }
198-
199198 @action
200199 setTransition ( phase : string , event : TransitionEvent ) : void {
201200 // we only want to respond to `width` animation/transitions
0 commit comments