-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[XY axis] Integrates legend color picker with the eui palette #90589
[XY axis] Integrates legend color picker with the eui palette #90589
Conversation
@miukimiu your feedback here is valuable! What do you think about the 4 rotations? |
Hi @stratoula , The 4 rotations are ok if the goal is to give to the user a similar number of colors as the legacy one. I think it would be weird to pick the legacy with so many colors and then the EUI palette with just a few. With this in mind, the 4 rotations sound good. But in both scenarios, legacy, and default EUI a lot of colors are very similar, almost impossible to distinguish. So do we need so many colors? Maybe the Elastic Charts team can recommend us what is an appropriate number of colors and based on that, we can lower or increase the number of colors for all the palettes. |
This is the reason that I went with 4 rotations but it seems weird to me as I def agree that the colours are pretty similar. |
From my perspective, I think fewer rotations the better, so 4 is fine with me. We could also just do a single rotation and create larger color selections inside the popover, similar to the quick colors on the bottom of the colors picker. This would be the best approach IMHO. if we do go with four rotations, I would like to see the popover width increase to align the rotations. This creates a pretty wide popover so maybe we could transpose the matrix to be more vertical and have the rotated values go from left to right instead of top to bottom. |
@elasticmachine merge upstream |
I like your proposal @nickofthyme but what troubles me is that when the users choose the legacy palette will see a different UI. @miukimiu wdyt? |
@stratoula yeah agreed, this is a tough call that I'm glad I don't have to make 😄 |
@elasticmachine merge upstream |
hey @stratoula @miukimiu @nickofthyme I'm not a designer but I hope this example can provide a different viewpoint on the color picker:
cc @monfera |
@elasticmachine merge upstream |
@markov00: Here are some of my initial thoughts based on your comments. I'm coming into this conversation a bit sideways, so please feel free to schedule something on the calendar if you think further discussion is warranted.
I generally agree with this suggestion (i.e. a reduction color options offered lowers chances of user decision paralysis and helps avoid potentially poor choices). However, I do wonder about those advanced users who would desire to have greater control over their colors. For example, Grafana defaults to offering a limited selection of colors, but also has the option for users to make custom colors if they wish. It's tucked away in a separate tab, but it's available for those advanced users. Perhaps that is beyond the scope of this PR, but thought I'd mention it.
I like this idea. Do you feel that two neutral colors would be sufficient for the majority of these use cases? Have you given any thought as to what should happen to these neutral colors if the user selects the "Gray" color palette? I imagine they'd need to be conditionally removed or incorporated in some way.
This is an interesting solution to avoid inundating the user with too many color options. Perhaps as an alternative to the "Variant" slider in your mockup, we could change it to a lightness/darkness slider. The hue and saturation stays true to the chosen color palette, but the user can adjust the lightness/darkness of the available colors.
The relationship between the legend-based color picker and the color palette field in the sidebar is interesting. I like the idea that the default colors presented in the legend-based picker being pulled from the chosen color palette. However, I'm not sure about the actually changing the entire palette from within the legend-based color picker popover (assuming that is what your mockup is suggesting). I worry the user might be confused as to whether they were changing the palette for the entire visualization or just that particular value.
If you mean in terms of being consistent in our usage of the latest color palette and color picker components, I agree. |
@elasticmachine merge upstream |
After syncing with @markov00 and @miukimiu we will go for this PR with @nickofthyme 's suggestion and I created another issue #92151 to initialize the discussions about how we can do it better in the future |
@elasticmachine merge upstream |
@nickofthyme I ordered them by If I order them by 4 columns it is not so good so I prefer it that way, wdyt? |
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review only - Presentation team changes LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, sorry for the long delay in my review!
I wasn't able to use the legend color picker widget with my keyboard at all so there are some significant issues here. I left comments on how I think they should be addressed and some other issues but let me know if you have any questions.
@@ -11,6 +11,11 @@ $visColorPickerWidth: $euiSizeL * 8; // 8 columns | |||
transform: scale(1.4); | |||
} | |||
|
|||
// removes the grey background that appears on the first dot when the popover is open | |||
&:focus { | |||
background-color: $euiColorEmptyShade; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks ok because we have that big circle around the color currently in use but, at the same time, this whole widget doesn't seem to be keyboard accessible (at least in Firefox) so I wasn't able to test how this looks like on buttons that aren't the currently selected color.
@elasticmachine merge upstream |
@myasonik thanx for your feedback, this picker exists for so many versions that I am happy that we could improve its accessibility issues with my PR. I tried to follow your comments, can you check it again? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks a lot closer (thank you!) but still has a few concerns.
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just one comment on the keyboard tabbing when the color picker is opened. Looks like the ownFocus
is not working as expected.
<EuiWrappingPopover | ||
isOpen | ||
ownFocus | ||
display="block" | ||
button={anchor} | ||
anchorPosition={getAnchorPosition(legendPosition)} | ||
closePopover={onClose} | ||
panelPaddingSize="s" | ||
> | ||
<ColorPicker | ||
color={paletteName === 'kibana_palette' ? color : color.toLowerCase()} | ||
onChange={handleChange} | ||
label={seriesName} | ||
useLegacyColors={paletteName === 'kibana_palette'} | ||
colorIsOverwritten={colorIsOverwritten} | ||
onKeyDown={onKeyDown} | ||
/> | ||
</EuiWrappingPopover> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how this was affected, but there seems to be no focus on the color dots when you using keyboard actions to open the color picker.
Below I focus a legend item and then tab to the color, hit enter and then tabbing when the color picker is open does nothing. I'm pretty sure this was working before.
Screen.Recording.2021-03-11.at.02.15.08.PM.mp4
@myasonik might have already mentioned this above. Not sure how to fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dots are now a radio group so arrow keys move you back and forward rather than tab.
If we think this is tricky for users at large, we can think about alternatives but I think this is better than where the component was at previously.
That said, there doesn't seem to be focus state initially (i.e., after you use arrow keys once, a focus state is visible but the first time you open a popover there doesn't seem to be anything).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see, that's fine. Thanks for the explanation. Yeah would be nice to have an initial state to know it focused on the popover.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean to focus on the first dot when it opens? I don't think we want this. We want to focus on the active color. Like here:
On your screenshot below @myasonik there is the legacy palette. The current series color doesn't exist on the popover so for this reason you don't see an active dot.
I think it is wrong to focus on the first dot, this means that every time I open the popover, the first color is selected and the chart will automatically change color. We def don't want this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently there is a :focus
state and I think an :active
or selected state. I think we should add back the focus state and auto focus the first color on focus of the color picker. See the recording below.
Screen.Recording.2021-03-15.at.09.19.58.AM.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was lost due to our change on custom input radio btns. I could add it with css but I am not sure about it. If you see Wylie's comment above, previously we had auto focus on the first element, which was quite confusing. I will sync with @myasonik offline to decide what we want to do here. Maybe we should revert to the previous tab navigation which works like that (taking under consideration that we want to change this behavior in the future):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elasticmachine merge upstream |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was looking in the wrong place earlier 🤦 Everything seems to be working as expected now!
To reiterate: we did change how the thing works a little (notably, moved from tab stops for every color, to arrow keys) but we were able to improve screen reader support a lot in that change so I think it was worth it even if there are still some rough edges.
With all of this being somewhat temporary until the next update anyways, I'm happy to ship this as is!
…c#90589) * XY Axis, integrate legend color picker with the eui palette * Fix functional test to work with the eui palette * Order eui colors by group * Add unit test for use color picker * Add useMemo to getColorPicker * Remove the grey background from the first focused circle * Fix bug caused by comparing lowercase with uppercase characters * Fix bug on complimentary palette * Fix CI * fix linter * Use uppercase for hex color * Use eui variable instead * Changes on charts.json * Make the color picker accessible * Fix ci and tests * Allow keyboard navigation * Close the popover on mouse click event * Fix ci Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
#94738) * XY Axis, integrate legend color picker with the eui palette * Fix functional test to work with the eui palette * Order eui colors by group * Add unit test for use color picker * Add useMemo to getColorPicker * Remove the grey background from the first focused circle * Fix bug caused by comparing lowercase with uppercase characters * Fix bug on complimentary palette * Fix CI * fix linter * Use uppercase for hex color * Use eui variable instead * Changes on charts.json * Make the color picker accessible * Fix ci and tests * Allow keyboard navigation * Close the popover on mouse click event * Fix ci Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
…-action * 'master' of github.com:elastic/kibana: (44 commits) Migrate the optimizer mixin to core (#94272) Replace EuiCodeBlock with JsonCodeEditor in DiscoverGrid (#92442) [ML] Anomaly Detection: Migrate validation messages links to use docLinks. (#94568) [Lists][Exceptions] - Adding basic linting, i18n and storybook support (#94772) [Fleet] Add test/fix for invalid/missing ids in bulk agent reassign (#94632) [Security Solution] [Cases] Move create page components and dependencies to Cases (#94444) [ML] Data Frame Analytics accessibility tests: fix flaky outlier creation test (#94735) [Security Solutions] Remove commented out old linter rules (#94753) [App Search] Role mappings migration part 2 (#94461) [CI] Update Backport action inputs to match updated ones (#94721) [chore] Remove the infra team from CODEOWNERS (#94740) [Connectors UI] Make UI use new connector APIs (#94180) [ML] Use indices options in anomaly detection job wizards (#91830) Remove `string` as a valid registry var type value (#94174) [Alerts] Replaces legacy es client with the ElasticsearchClient for alerts and triggers_actions_ui plugins. (#93364) [Reporting-CSV Export] Re-write CSV Export using SearchSource (#88303) chore(NA): upgrade bazel rules nodejs to v3.2.2 (#94726) [APM] Settings: Update layout and update/add descriptions (#94398) skip flaky suite (#94666) [XY axis] Integrates legend color picker with the eui palette (#90589) ... # Conflicts: # x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/cold_phase/cold_phase.tsx # x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/searchable_snapshot_field/searchable_snapshot_field.tsx # x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/constants.ts # x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.tsx # x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/configuration_context.tsx # x-pack/plugins/index_lifecycle_management/public/shared_imports.ts
Summary
With the new XY axis implementation we give the users the ability to change the palette for these visualizations. The users can choose between the eui palettes and the legacy one.
The users can also overwrite the rendered colors by clicking on the legend color and apply a color. So far, they could choose between custom colors of the legacy palette.
With this PR the legend colors depend on the palette chosen. When the user chooses an EUI palette the legend colors are a superset of the default eui palette while if the user chooses the legacy palette the colors of the legend are the legacy ones.
I have used a rotation of 4.
User has chosen the legacy palette:
![Screenshot 2021-02-08 at 10 52 06 AM](https://user-images.githubusercontent.com/17003240/107230318-99b55a00-6a27-11eb-9ecd-ebe5c58d5e14.png)
User has chosen the default eui palette:
![image](https://user-images.githubusercontent.com/17003240/109126697-3c731580-7756-11eb-82d6-9af1e81d295f.png)
Checklist