Picture of Nemanja Stepanovic
Preventing Drawer from closing
by Nemanja Stepanovic - Tuesday, 25 April 2017, 1:26 PM
 

Hi everyone,

I'm trying to have the drawer close only when the user presses it's "X" button (at the moment it closes when pressing any button on the page or links within the drawer), but just can't seem to find the part of code that does the work. I'm not using the framework, instead I was using the Authoring Tool for basic course construction and then exported the course for further functional alterations.

Any help is greatly appreciated!

Picture of Matt Leathes
Re: Preventing Drawer from closing
by Matt Leathes - Tuesday, 25 April 2017, 9:00 PM
 

Hi Nemanja

The code to close the drawer when you click outside of it is here.

The code to close it when you press the Esc key is here.

As for closing when you click on a button within the drawer - that's controlled by whatever extension is in the drawer at that time.

So adapt-contrib-resources doesn't close the drawer when one of its items is clicked - but adapt-contrib-pageLevelProgress does.

Hope this helps

 

 

Picture of Nemanja Stepanovic
Re: Preventing Drawer from closing
by Nemanja Stepanovic - Wednesday, 26 April 2017, 7:33 AM
 

HI Matt,

Thanks for a quick reply! It was a long day at work yesterday so I completely forgot to mention, but I've already removed the "white-shadow" from the screen, so the part of code that causes drawer to close when clicking on the shadow is already obsolete. I am however, using the quick navigation plug-in, that places Back/Next/Home buttons at the bottom of the screen allowing the user to quickly move between different pages, so whenever I press the next button for example, and move onto the next page the drawer closes - this is something I have to prevent from happening. If you have any ideas on solving this issue please let me know!

The plug-in I'm talking about is here: https://github.com/cgkineo/adapt-quicknav

Picture of Nemanja Stepanovic
Re: Preventing Drawer from closing
by Nemanja Stepanovic - Wednesday, 26 April 2017, 9:00 AM
 

Actually nevermind. I fogured it out! :)
It was because of this line: this.listenTo(e, "remove", this.onCloseDrawer);

Thanks anyways!

Best,

Picture of Matt Leathes
Re: Preventing Drawer from closing
by Matt Leathes - Wednesday, 26 April 2017, 9:34 AM
 

Just to warn you - this may be a bit of a dangerous thing to do. It's certainly never been tested, you should proceed with caution. It will certainly break accessibility - though obviously if you don't need that it doesn't matter.