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

[Maps] Fix long field truncation on Comboboxes #171829

Merged
merged 6 commits into from
Nov 29, 2023

Conversation

mbondyra
Copy link
Contributor

@mbondyra mbondyra commented Nov 23, 2023

Summary

Fixes #171509 (fixed in all the places in maps)

Adds middle truncation and combobox auto-expansion to the content to approximate of 60 character maximum for SingleFieldSelect and FieldSelect components in maps.
I removed custom renderOption prop so the combobox can take care of the proper truncation while searching through the fields. One case I had to hack was to display a tooltip for a disabled state. I used prepend and some custom styling to do so - it works as before (check out the screenshot below).

FieldSelect component before Screenshot 2023-11-22 at 16 08 21
FieldSelect component after Screenshot 2023-11-22 at 16 10 02
SingleFieldSelect component before Screenshot 2023-11-23 at 10 23 15
SingleFieldSelect component after Screenshot 2023-11-22 at 16 32 43

disabled state

Screenshot 2023-11-22 at 17 10 48

@mbondyra mbondyra added Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas loe:medium Medium Level of Effort release_note:skip Skip the PR/issue when compiling release notes Feature:Maps v8.12.0 impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. labels Nov 23, 2023
@mbondyra mbondyra changed the title [Maps] [Maps] Fix long field truncation on Comboboxes [Maps] Fix long field truncation on Comboboxes Nov 23, 2023
@mbondyra mbondyra added loe:small Small Level of Effort and removed loe:medium Medium Level of Effort labels Nov 23, 2023
@mbondyra mbondyra force-pushed the maps_widen_comboboxes branch 2 times, most recently from 94ceba9 to 40503c7 Compare November 28, 2023 12:42
@mbondyra mbondyra marked this pull request as ready for review November 28, 2023 14:42
@mbondyra mbondyra requested a review from a team as a code owner November 28, 2023 14:42
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

@nreese nreese self-requested a review November 28, 2023 15:03

if (disabledReason) {
option.prepend = (
<>
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mean the tooltip is only on prepend icon? Is there any way to keep the tooltip on the entire value? Could renderOption still be used?

Copy link
Contributor Author

@mbondyra mbondyra Nov 28, 2023

Choose a reason for hiding this comment

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

it is not, it happens inside the entire value because of the custom css we place there. It works exactly as before. We cannot use renderOption if we want to take advantage of internal combobox truncation.

Copy link
Contributor

Choose a reason for hiding this comment

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

How difficult is it to do the truncation in renderOptions? I think its important to keep the tooltip target over the entire text, otherwise, its really difficult to trigger.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is how it works, sorry I wasn't clear before. I agree it's important to keep the tooltip target over the entire text and it is kept this way in this PR. Right now it doesn't make sense to do the truncation in renderOption because the implementation is not straightforward and it's complex (the problem is not truncation but proper selecting text when searching through it). Please take a look at this video:

Screen.Recording.2023-11-28.at.20.38.49.mov

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for clarifying

Copy link
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

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

kibana-gis changes LGTM. Thanks for putting this fix together. Really appreciate it!
code review and tested in chrome

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Defend Workflows Cypress Tests on Serverless #6 / Response console Execute operations: "execute --command" - should execute a command "execute --command" - should execute a command

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
maps 1093 1097 +4

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
maps 2.9MB 2.9MB +432.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
maps 46.7KB 46.9KB +117.0B

History

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

@mbondyra mbondyra merged commit 37d5aca into elastic:main Nov 29, 2023
31 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Nov 29, 2023
@mbondyra mbondyra deleted the maps_widen_comboboxes branch November 29, 2023 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Maps impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:small Small Level of Effort release_note:skip Skip the PR/issue when compiling release notes Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v8.12.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Maps] Fix long field truncation on Comboboxes in Maps
5 participants