Skip to content

Commit

Permalink
WIP Fix fastboot compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
nickschot committed Jan 26, 2024
1 parent 4a24a16 commit 7ef3c74
Show file tree
Hide file tree
Showing 5 changed files with 389 additions and 3 deletions.
16 changes: 14 additions & 2 deletions ember-mobile-menu/src/components/mobile-menu/tray.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Component from '@glimmer/component';
import { htmlSafe } from '@ember/template';
import { action } from '@ember/object';
import { disableBodyScroll, enableBodyScroll } from 'body-scroll-lock';
import './tray.css';
import { task } from 'ember-concurrency';

/**
* The tray that resides within the menu. Menu content is placed in here.
Expand Down Expand Up @@ -84,7 +84,19 @@ export default class TrayComponent extends Component {

@action
toggleBodyScroll(target, [isClosed]) {
if (this.args.preventScroll && !this.args.embed) {
this.toggleBodyScrollTask.perform(target, isClosed);
}

@task({ enqueue: true })
*toggleBodyScrollTask(target, isClosed) {
if (
this.args.preventScroll &&
!this.args.embed &&
typeof FastBoot === 'undefined'
) {
let { disableBodyScroll, enableBodyScroll } = yield import(
'body-scroll-lock'
);
if (isClosed) {
enableBodyScroll(target);
} else {
Expand Down
Loading

0 comments on commit 7ef3c74

Please sign in to comment.