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

Document Handler - Drawer Static Button Bug #1414

Closed
OlofSvahnVbg opened this issue Oct 6, 2023 · 2 comments
Closed

Document Handler - Drawer Static Button Bug #1414

OlofSvahnVbg opened this issue Oct 6, 2023 · 2 comments
Labels
Milestone

Comments

@OlofSvahnVbg
Copy link
Collaborator

OlofSvahnVbg commented Oct 6, 2023

If you choose to have the drawer permanently locked in place...
image

... an inactive button still appears:
MicrosoftTeams-image

There is logic implemented to keep this from happening, and the problem does not seem to appear in kommungis-utv...
image

... and I'm not sure why this problem occurs, actually. Perhaps something wrong with drawerButtons in App.js.

@OlofSvahnVbg OlofSvahnVbg added this to the 3.x milestone Oct 6, 2023
@OlofSvahnVbg
Copy link
Collaborator Author

OlofSvahnVbg commented Oct 10, 2023

It seems that drawerButtons sometimes contains an "empty button". In other words, if plugins is empty in some views, it has 0 items and gets styling hidden or display none or something. The prop hideOnMdScreensAndAbove controls this.

The problem is that the drawerButtons then contains 2 buttons (one visible and one invisible), which messes up the checkDrawerButtons(), because it counts 2 buttons and therefore does not remove the single visible button.

@OlofSvahnVbg
Copy link
Collaborator Author

Potential fix for this:

  checkDrawerButtons() {
    const hasHiddenPlugin = this.state.drawerButtons.some(
      (db) => db.hideOnMdScreensAndAbove
    );
    const hasMultipleButtons = this.state.drawerButtons.length > 1;

    return (
      !this.state.drawerStatic ||
      (this.state.drawerStatic && hasMultipleButtons && !hasHiddenPlugin)
    );
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

No branches or pull requests

3 participants