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

Add loading indicator to dark mode toggle #165159

Open
legrego opened this issue Aug 29, 2023 · 8 comments
Open

Add loading indicator to dark mode toggle #165159

legrego opened this issue Aug 29, 2023 · 8 comments
Labels
enhancement New value added to drive a business result Feature:Security/User Profile Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more!

Comments

@legrego
Copy link
Member

legrego commented Aug 29, 2023

We recently added an inline dark-mode toggle to the user avatar dropdown:
Larry Gregory 2023-08-29 at 15 51 40@2x

Persisting the user's theme preference can sometimes take several seconds, and during this time there is no visual indication that Kibana is "working on it".

We should add a visual indication that the operation is in progress.

@legrego legrego added Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! enhancement New value added to drive a business result Feature:Security/User Profile labels Aug 29, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-security (Team:Security)

@legrego
Copy link
Member Author

legrego commented Oct 17, 2023

Hey @MichaelMarcialis, do you have any suggestions for how to best show a loading indicator here? The Switch component that we're using here doesn't offer a loading state, and we have concerns that switching the control out for a loading indicator would look janky.

@MichaelMarcialis
Copy link
Contributor

Hey @MichaelMarcialis, do you have any suggestions for how to best show a loading indicator here? The Switch component that we're using here doesn't offer a loading state, and we have concerns that switching the control out for a loading indicator would look janky.

@legrego: Good question. The switch in general is problematic, as the theme setting in user profiles has three options, not two: space default, light, dark. Ideally, in the future, we will remove space-level controls for themes and replace the space default option with the user's OS or browser defaults. Either way, the switch component can't properly convey the fact that there are three options.

Also, we're currently using mixed nomenclature and iconography for the setting. Here it's labeled as "Dark mode" with a sun icon, while in the user profile settings we call it "Theme mode". Would it be better to keep these consistent?

Perhaps there's a better way we can present this, while also addressing the loading issue you mention. Here's some quick thoughts in a mockup.

CleanShot 2023-10-18 at 11 17 12

I've included options for either a text-based or icon-based version, but ultimately the goal for both was to be more consistent with how we present these options to better match the user profile setting. It also visually differentiates itself better from the regular context menu items. For the loading state, we can use an animated EuiProgress component to show that something is happening after the user makes their theme selection. Thoughts?

@thomheymann
Copy link
Contributor

@MichaelMarcialis What do you think the use case is for reverting to the "space default"? I appreciate that most platforms give a "system default" option but that is very different and not what "space default" is. System default means that an app can automatically adjust to the operating system (which might change its theme depending on the time of day) so I can see why a user would want to select that setting. From a user perspective "space default" simply means to use whichever theme an administrator set for that space. Keeping in mind that the user wouldn't even know what that theme is when selecting it it feels fairly edge case'y.

@MichaelMarcialis
Copy link
Contributor

MichaelMarcialis commented Oct 18, 2023

@MichaelMarcialis What do you think the use case is for reverting to the "space default"? I appreciate that most platforms give a "system default" option but that is very different and not what "space default" is. System default means that an app can automatically adjust to the operating system (which might change its theme depending on the time of day) so I can see why a user would want to select that setting. From a user perspective "space default" simply means to use whichever theme an administrator set for that space. Keeping in mind that the user wouldn't even know what that theme is when selecting it it feels fairly edge case'y.

Honestly speaking, I don't think there is a particularly good use case for the "Space default" option. The only reason I'm including it here is because it's technically an option we currently offer in user profile and advanced settings. And because we do offer it, omitting the option (as in the switch scenario) raises some UX questions and sharp corners. With a switch that only shows options for light/dark mode, how does a user know if/when they are using space default? If they do switch away from space defaults, how would they get back to using space defaults if they change their mind?

As I mentioned previously, ideally we simply would remove the theme mode selection from space advance settings altogether and replace it with a browser/OS default option. And in that case, I think the UI I mocked up above still applies. Dark/light mode is a user-level decision and really has no place as a space-level setting.

@thomheymann
Copy link
Contributor

If they do switch away from space defaults, how would they get back to using space defaults if they change their mind?

I think that's what I was trying to get at. I'm not sure this is something we need to solve in such a prominent location.

I think it's a fairly common approach to simplify available options to the most common use cases in a global navigation.

In terms of the designs I really like the treatment but I'm not sure if there's a suitable icon for "space default". I don't think "Default" is clear enough since it can be easily confused with system default which is the more commonly known setting in this context.

@legrego
Copy link
Member Author

legrego commented Dec 12, 2023

Core may soon have support for respecting the OS preference for light/dark mode via #173044. We should aim to support this for user profiles soon as well (#155945), so we don't have a feature gap between the two methods of configuring a theme.

So even if we ignore the Space Default option, it seems that we'll end up with a three-state selection after all (System, Light, Dark). I'm open to other design ideas, however.

@MichaelMarcialis
Copy link
Contributor

Core may soon have support for respecting the OS preference for light/dark mode via #173044. We should aim to support this for user profiles soon as well (#155945), so we don't have a feature gap between the two methods of configuring a theme.

So even if we ignore the Space Default option, it seems that we'll end up with a three-state selection after all (System, Light, Dark). I'm open to other design ideas, however.

That's excellent news! I would personally love offering the user only those three options (system, light, dark) everywhere (both in the user dropdown and user settings page), and removing space-level control over theme mode selection altogether.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result Feature:Security/User Profile Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more!
Projects
None yet
Development

No branches or pull requests

4 participants