adapt_framework icon indicating copy to clipboard operation
adapt_framework copied to clipboard

toggleDrawer btn in the navigation has issues closing the drawer if there is only 1 item

Open nilslp opened this issue 8 years ago • 3 comments

Subject of the issue/enhancement/features

The toggleDrawer button in the navigation has issues closing the drawer if there is only 1 item. I think it is due to this conditional: https://github.com/adaptlearning/adapt_framework/blob/legacy/src/core/js/views/drawerView.js#L118

I am not sure there needs to be any other conditions other than isVisible or !isVisible as the toggle should toggle show/hide. If I am wrong in this then I think the issue lies in how _isCustomViewVisible is set when there is only 1 item on the drawer.

However, I don’t think this has been seen to often (especially not if using the Vanilla theme with the Box menu) as the drawer will always cover the toggleBtn so it is never used to close the drawerView. If you want to give it a quick test before discussing bump .navigation zIndex to 10000 and test with 1 drawer item (e.g. enable the search extension - https://github.com/cgkineo/adapt-search)

@tomgreenfield mentioned this adaptlearning/adapt_framework#218 so the above is expected functionality.

However there is still an issue with not being able to close the drawer using the toggleBtn.

So i think the problem is that when there is only 1 drawer item _isCustomViewVisible is being set to true when it should be false, because of

if(this.collection.models.length === 1) {
    Adapt.trigger(this.collection.models[0].get('eventCallback'));

Setting this._isCustomViewVisible = false; after that creates this UX:

  • A user can click toggleDrawer it will open and it will show the drawerItems
  • A user can click progressBar when drawer is open and it will show progressBar stats in the drawer
  • A user can then click toggleDrawer again and it will show the drawerItems again
  • A further click on toggleDrawer will hide the drawer

This should be in keeping with the link adaptlearning/adapt_framework#218 @tomgreenfield mentioned but also hiding the drawer using the toggleBtn

Your environment

  • version (AT/Framework): 2.2.6
  • which browser and its version: Any browser
  • device(s) + operating system(s): mac OS Sierra

Steps to reproduce

If you want to give it a quick test before discussing bump .navigation zIndex to 10000 and test with 1 drawer item (e.g. enable the search extension - https://github.com/cgkineo/adapt-search)

Expected behaviour

toggleBtn should show/hide the drawer

Actual behaviour

toggleBtn only shows the drawer

nilslp avatar Aug 09 '18 09:08 nilslp

PR for the legacy fix here - https://github.com/adaptlearning/adapt_framework/pull/2211

nilslp avatar Aug 15 '18 11:08 nilslp

@nilslp does this still need fixing in legacy? the above PR was closed before it got merged.

Could really do with releasing legacy branch soon and would be great to include a fix for this in that release if at all possible.

moloko avatar Sep 10 '18 12:09 moloko

Sorry @moloko just seeing this, @brian-learningpool has mentioned this to me. Will create a PR to go into legacy now. Thanks

nilslp avatar Sep 17 '18 11:09 nilslp