Skip to content
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

Fix fastboot compatibility and add smoke test #429

Closed
wants to merge 2 commits into from
Closed
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
16 changes: 14 additions & 2 deletions addon/addon/components/mobile-menu/tray.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Component from '@glimmer/component';
import { htmlSafe } from '@ember/template';
import { action } from '@ember/object';
import { disableBodyScroll, enableBodyScroll } from 'body-scroll-lock';
import { task } from 'ember-concurrency';

/**
* The tray that resides within the menu. Menu content is placed in here.
Expand Down Expand Up @@ -83,7 +83,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
5 changes: 5 additions & 0 deletions addon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

module.exports = {
name: require('./package').name,
options: {
babel: {
plugins: [require.resolve('ember-auto-import/babel-plugin')],
},
},

included() {
let app = this._findHost();
Expand Down
Loading