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

Advanced settings UI change to centralize save state #53693

Merged

Conversation

mbondyra
Copy link
Contributor

@mbondyra mbondyra commented Dec 20, 2019

Summary

Fixes #27405

Converts the contextual advanced settings menu to the shared one:
Before:
image

After:
image

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@mbondyra mbondyra force-pushed the IS-27405_improve-advanced-settings-save branch from 0c993ee to 122b838 Compare December 30, 2019 15:48
@elastic elastic deleted a comment from elasticmachine Dec 30, 2019
@mbondyra mbondyra force-pushed the IS-27405_improve-advanced-settings-save branch 2 times, most recently from fe38fee to 87a563f Compare January 6, 2020 12:05
@mbondyra mbondyra force-pushed the IS-27405_improve-advanced-settings-save branch 10 times, most recently from 14379ea to 3d96af4 Compare January 16, 2020 08:16
@cchaos
Copy link
Contributor

cchaos commented Jan 16, 2020

@gchaps We'd love to get your help with some copy changes we're making to the Advanced Settings UI. The gist is that instead of having Save/Cancel buttons per setting, there will be a "dirty" state that will popup a single bottom bar with "Save all"/"Cancel all" buttons. There will also be indicators showing which settings have been changed but not saved.

image

Copy

1. Unsaved indicator (bottom left of bottom bar).
a. 2 Unsaved settings
b. When using search to narrow down settings, some settings may get hidden: 2 (1 hidden) Unsaved settings

2. Save/Cancel buttons since clicking will save/cancel ALL unsaved settings
a. Save changes
b. Cancel all changes

3. Disabled Save button tooltip
When one of the fields they've changed is invalid, we disable the Save button. Here is what the tooltip currently says:
You must fix all invalid settings before saving.

4. The very last setting (Telemetry) callout
This setting doesn't behave the same as the others (doesn't get added to the dirty state, but saves automatically) because of technical limitations. We want to add more description to the current callout to bring attention to the fact that it will be saved automatically. This is what we have so far:
This setting applies to all of Kibana and will be saved immediately.

5. Reload notification toast
Some settings require browser refreshes to take effect. We originally had a toast that also named the setting in the toast message:

But, since there could be more than one setting that requires a reload, we're thinking about making this message more generic like:
One or more of the saved settings requires a page reload to take effect.

@gchaps
Copy link
Contributor

gchaps commented Jan 16, 2020

1. Unsaved indicator
I suggest singular for 1, and plural for more than one.

1 unsaved setting
2 unsaved settings
2 unsaved settings, 1 of which is hidden

2. Save/Cancel buttons
I think it's ok to eliminate the word "all" in both button labels.

Save changes
Cancel changes

3. Disabled Save button tooltip
Fix invalid settings before saving.

4. Telemetry
Changes to this setting apply to all of Kibana and are saved automatically.

5. Reload notification toast
One or more settings require you to reload the page to take effect.

@cchaos
Copy link
Contributor

cchaos commented Jan 17, 2020

Thanks @gchaps ! My only comment is that 2 unsaved settings, 1 of which is hidden seems very wordy and will take up a lot of space. Any way to shorten it?

@gchaps
Copy link
Contributor

gchaps commented Jan 17, 2020

How about:

2 unsaved settings, 1 hidden

@mbondyra mbondyra force-pushed the IS-27405_improve-advanced-settings-save branch from 9a79d9f to 0eb9b9e Compare January 23, 2020 17:37
@mbondyra mbondyra marked this pull request as ready for review January 23, 2020 17:39
@mbondyra mbondyra requested review from a team as code owners January 23, 2020 17:39
@mbondyra mbondyra added Feature:Kibana Management Feature label for Data Views, Advanced Setting, Saved Object management pages release_note:enhancement Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.7.0 v8.0.0 labels Jan 23, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@mbondyra mbondyra changed the title WIP: Advanced settings UI change to centralize save state Advanced settings UI change to centralize save state Jan 23, 2020
@myasonik
Copy link
Contributor

@cchaos

My original thought about this form is that it now actually behaves as one giant form (with a submit button) instead small individual forms (with submit buttons). Therefore, I don't know why we'd need a "Setting is currently not saved." screen reader text when you don't indicate changed fields like this in normal forms.

In short, because it can be so difficult to navigate this page. (In detail: the page is long, has many tab stops, has many form elements, has many headings, isn't wrapped by an actual <form> and so doesn't have a form onsubmit event, even if we did wrap it in a <form> the BottomBar wouldn't be in it because of the portal, and the submit and cancel buttons aren't even in the same main landmark because of the portal as well.) The higher the complexity of the page, the more context we want to give users on what is going on.

I'm trying not to crowd this already giant form with more indicators of state. The thought behind this bar is that it does indicate there's something different about this setting over another setting that hasn't been changed. There's a stark contrast between existing and not existing indicates a difference. And the indicator shows as soon as they change something, hopefully showing causation of the indicator.

The bar and the contrast do show that something is different but what I'd also like to be able to solve is having to know which contrast means what. UI friendly to cognitive load (which might be compromised from permanent, temporary, or situational variables) will let you glean all the info you need just by looking at it without prior knowledge. So, especially when you combine this and the next point, looking at just a setting - I don't know if the green bar means this setting is "all good, don't worry about it" or, as it means in this case "you've changed something here".

The bottom bar exists in a portal that is fixed to the window so it doesn't scroll away with the content.

It doesn't scroll away and is visible on the page, but the two controls (the setting and the save) are now very far apart from each other. Screen zoom, which is different than your browser's page zoom, will usually clip off parts (often, most) of the page and only show you a small portion. Pinch-to-zoom on touch devices is an example of this (though, position:fixed will actually sometimes - but not always - be preserved in this case) but other examples of this are Microsoft's Magnifier, Mac's Zoom (Settings > Accessibility > Zoom), or 3rd-party products like ZoomText. (Links are to demo videos if you want to check them out.) Assistive tech usage numbers are really hard to come by and are often questionable when they do come up anyways, but from the community folks I follow on Twitter, this type of zooming tech is reportedly often more popular than screen readers because the learning curve is generally lower and sites have less ways of messing it up (where as screen readers can be entirely hampered by a bad site). So I'm hoping we can provide something that will hint to users that they still need to perform a second save action that they may not see right away.

Writing all of this up has lead me to an important question: What about auto-save? Some of the settings I know require a page refresh so many we can't do it with all but could most of them be saved immediately when changed?

@cchaos
Copy link
Contributor

cchaos commented Feb 18, 2020

I'm going to restate @myasonik's question since it might have gotten lost in the rest of his comment:

What about auto-save? Some of the settings I know require a page refresh so many we can't do it with all but could most of them be saved immediately when changed?

@mbondyra
Copy link
Contributor Author

mbondyra commented Feb 19, 2020

Hi @cchaos @myasonik

We discussed the auto-save idea with @timroes and decided that it would cause more problems and requires additional design.

  1. We describe advanced settings as 'for very advanced users only. (...) can break large portions of Kibana.' The save button is additional 'think again before you confirm' check. In the autosave scenario, there's no way for the user to come back to the previous value of the setting ('cancel' the change) and that's an important one. Adding another 'reset to previous value' button would solve a problem but it seems weird to have two reset buttons
  2. For text inputs we would have to save on blur and that's not intuitive behaviour, so we would need to keep save button for these ones
  3. Imagine the scenario: user modifies the value, saving is run, but network fails. What do we do in this case? 'Retry' button?

To improve accessibility on this page in the current state we want to:

  1. Prevent from navigating away (alert on leaving the page), but this one requires help from app arch team so for now, it's impossible.
  2. I added to the Title EuiScreenReaderOnly element for unsaved/invalid elements for text hint that element is unsaved.

Let me know your thoughts.

* master: (136 commits)
  [Visualize] Remove legacy appState in visualize (elastic#57330)
  Use static time for tsvb rollup test (elastic#57701)
  [SIEM] Fix ResizeObserver polyfill (elastic#58046)
  [SIEM][Detection Engine] Fixes return codes where some were rule_id instead of id
  skip flaky suite (elastic#56816)
  skip flaky suite (elastic#58059)
  skip flaky suite (elastic#45348)
  migrates notification server routes to NP (elastic#57906)
  Moved all of the show/hide toggles outside of ordered lists. (elastic#57163)
  [APM] NP Migration - Moves plugin server files out of legacy (elastic#57532)
  [Maps][Telemetry] Migrate Maps telemetry to NP (elastic#55055)
  Embeddable add panel examples (elastic#57319)
  Fix useRequest to support query change (elastic#57723)
  Allow custom paths in plugin generator (elastic#57766)
  [SIEM][Case] Merge header components (elastic#57816)
  [ML] New Platform server shim: update job audit messages routes (elastic#57925)
  [kbn/optimizer] emit success event from reducer when all bundles cached (elastic#57945)
  [APM] Don’t include UI filters when fetching a specific transaction (elastic#57934)
  Upgrade yargs (elastic#57720)
  skip flaky suite (elastic#57762) (elastic#57997) (elastic#57998)
  ...

# Conflicts:
#	src/plugins/advanced_settings/public/management_app/components/field/__snapshots__/field.test.tsx.snap
#	src/plugins/advanced_settings/public/management_app/components/field/field.tsx
#	x-pack/plugins/translations/translations/ja-JP.json
#	x-pack/plugins/translations/translations/zh-CN.json
Comment on lines 467 to 477
{unsavedChanges && (
<EuiScreenReaderOnly>
<p>
{unsavedChanges.error
? unsavedChanges.error
: i18n.translate('advancedSettings.field.settingIsUnsaved', {
defaultMessage: 'Setting is currently not saved.',
})}
</p>
</EuiScreenReaderOnly>
)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this doesn't work because of the way that EUI renders forms at the moment (I opened a bug for it elastic/eui#2888).

I tried a few different things and the thing that I thought worked best was moving this from the renderTitle function to the renderField function.

For each field, add an aria-describedby="{uniqueID}". Then, in the render function, right after the {this.renderField(setting)} line, you can put all this stuff with the same uniqueId on the <p>.

Can talk through it more tomorrow!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@myasonik I corrected the code according to your comments. That, however adds aria-describedby to every element, even the ones that don't have relative <p> element. Is this ok?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aria-describedby should always point to a real id that exists on the page.

The contents can be empty though.

Does that make sense?

…_improve-advanced-settings-save

* commit '02efb01c481f9f24d8d707f06dfc68b2fb805001': (43 commits)
  [Endpoint] Add a flyout to alert list. (elastic#57926)
  Make sure index pattern has fields before parsing (elastic#58242)
  Sanitize workpad before sending to API (elastic#57704)
  [ML] Transform: Support multi-line JSON notation in advanced editor (elastic#58015)
  [Endpoint] Refactor Management List Tests (elastic#58148)
  [kbn/optimizer] include bootstrap cache key in optimizer cache key (elastic#58176)
  Do not refresh color scale on each lookup (elastic#57792)
  Updating to @elastic/lodash@3.10.1-kibana4 (elastic#54662)
  Trigger context (elastic#57870)
  [ML] Transforms: Adds clone feature to transforms list. (elastic#57837)
  [ML] New Platform server shim: update fields service routes (elastic#58060)
  [Endpoint] EMT-184: change endpoints to metadata up and down the code base. (elastic#58038)
  document difference between log record formats (elastic#57798)
  Expose elasticsearch config schema (elastic#57655)
  [ui/agg_response/tabify] update types for search/expressions/build_tabular_inspector_data.ts (elastic#58130)
  [SIEM] Cleans Cypress tests code (elastic#58134)
  fix: 🐛 make dev server Storybook builds work again (elastic#58188)
  Prevent core savedObjects plugin from being overridden (elastic#58193)
  Expose serverBasePath on client-side (elastic#58070)
  Fix legend sizing on area charts (elastic#58083)
  ...
…_improve-advanced-settings-save

* commit '98aa1d2d4f974f72a9a5397b1b91f11509f6fb7a':
  [SIEM] [Case] Enable case by default. Snake to camel on UI (elastic#57936)
  [File upload] Update remaining File Upload dependencies for NP migration (elastic#58128)
  Use EuiTokens for ES field types (elastic#57911)
  Added UI support for the default action group for Alert Type Model (elastic#57603)
  force savedObject API consumers to define SO type explicitly (elastic#58022)
  Update dependency @elastic/charts to ^17.1.1 (elastic#57634)
@mbondyra
Copy link
Contributor Author

@elasticmachine merge upstream

@mbondyra
Copy link
Contributor Author

@elasticmachine merge upstream

@mbondyra
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@timroes timroes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on Chrome linux, code LGTM so far. The remaining issues can imho be addressed in follow up PRs.

Copy link
Contributor

@myasonik myasonik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good for now 👍

In a future a11y PR I'd like to fix two things:

  1. The visual indicator that we've talked about before
  2. EuiSwitch currently has two labels (an aria-label and an aria-labelledby) which generally doesn't work (this may require work in EUI though in which case we can open up a ticket instead, I didn't dig deep enough to figure out where the issue is coming from)

@mbondyra mbondyra merged commit c6f5fdd into elastic:master Feb 24, 2020
@mbondyra mbondyra deleted the IS-27405_improve-advanced-settings-save branch February 24, 2020 16:42
mbondyra added a commit to mbondyra/kibana that referenced this pull request Feb 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Kibana Management Feature label for Data Views, Advanced Setting, Saved Object management pages release_note:enhancement Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.7.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Advanced Settings] Improve dirty state UI (save and cancel buttons)
8 participants