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

support disable items? #17

Open
vtarchon opened this issue Aug 13, 2020 · 4 comments
Open

support disable items? #17

vtarchon opened this issue Aug 13, 2020 · 4 comments

Comments

@vtarchon
Copy link

in https://github.com/SpiderStrategies/Scoreboard/issues/20259 it shows a bootslide menu with disabled menu items. we could bolt on this in impact, but it seems like this might be better in bootslide itself

@jerryorr have you needed to do this before?

@jerryorr
Copy link
Member

We did something similar with showing/hiding menu items: 29ef097#diff-a549978c7de72a7d567143ec615e0b08

That particular change allowed the menu items to be hidden: true on initial render, and also provided a toggleItem() function to change the visibility at runtime.

Disabling is a little more involved, because there are a couple extra things to consider:

  1. What "disabled" looks like varies depending on the control type (simple text/icon vs toggle vs checkmark etc...). It might make sense to have bootslide add/remove an is-disabled class to the menu element, but Impact probably needs to have the CSS that styles it appropriately.
  2. When a menu item is clicked on, the target callback is called so Impact can do whatever needs to happen. We could have Bootslide neglect to call the target callback if it's disabled, but there are similar scenarios where if a user clicks on a disabled button, we pop up a tooltip explaining why it's disabled (like trying to remove related items that come from a template). We'll have to decide how we want to handle that.

@vtarchon
Copy link
Author

@scottoreilly your call, do we need to support disabled items, or do we just hide the item if it can't be selected?

@mattsgarlata
Copy link
Member

It looks like this is the screenshot showing the disabled item:

66398418-b82ac180-e9ab-11e9-9e96-b88ad6131639

Usually when an item is disabled we like to have clicking on it display a tooltip explaining why it's disabled. However, we don't do tooltips within tooltips anywhere. I see 3 options:

  1. Use a tooltip to explain the disabled tooltip item (tooltips within tooltips). This is probably not a good idea because there will be complicated logic about when to dismiss which tooltip depending on where you click.
  2. Use a dialog to explain the disabled tooltip item
  3. Hide the disabled item

@scottoreilly
Copy link
Member

I don't love the idea of a tooltip in a tooltip, but I think it's the best option in this situation. We do it in a few other places too.

2020-08-14_14-28-01

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

No branches or pull requests

4 participants