Skip to content

[EuiComboBox] Allow dropdown to expand to not truncate options #2082

Closed as not planned

Description

@cjcenizal

This would solve the problem documented in elastic/kibana#36409

image

Activity

  1. chandlerprall commented on Jul 3, 2019

    @chandlerprall
    Contributor

    Took some time to look into this.

    Complications

    • react-virtualized requires the width prop to be set, will not auto-expand to fit content
    • EuiComboBox is designed to size up to but not exceeding 400px. This governed by CSS.
    • The options' widths are set to fill the parent's space.
    • Options auto-truncate via CSS

    Solution requirements

    • provide an exact width to react-virtualized
    • compute options' widths apart from the DOM values (can't inspect an element's clientWidth, for example)
    • update combobox CSS and JS to support both implementations

    Proof of concept

    I don't particularly like this approach, but wasn't able to come up with anything different. I also didn't try to reconcile the current max-width: 400px with the new setup, instead forcing all dropdowns to auto-fit their contents.

    • Measure rendered width of labels when the dropdown expands
      • allows options to be dynamic
      • waits for CSS to be downloaded/applied, important for including the correct font style
    • All browsers (only tested the PoC in Chrome) support CanvasRenderingContext2D.measureText()
    • Canvas context needs to have the correct font style applied
      • the PoC cheats here by assuming the input box's font is the same size as the options list

    Changes can be viewed at master...chandlerprall:feature/expanding-combobox-dropdown

    proof of concept

  2. cchaos commented on Jul 12, 2019

    @cchaos
    Contributor

    My thoughts:

    A. I don't think it's ok to expand the dropdown's width indefinitely. There will be many issues that will arise from this including going completely off screen.

    Screen Shot 2019-07-11 at 22 30 20 PM

    B. That being said we could give it a default max-width of 400px allowing the dropdown to grow to 400px even if the input is narrower.

    C. However, that would mean we need to change some styles of the dropdown quite a bit and would want to consider centering the dropdown to the input.

    Something like, but not enamored by:

    Screen Shot 2019-07-11 at 22 37 27 PM

  3. kertal commented on Nov 28, 2019

    @kertal
    Member

    since this is coming in frequently from different sources, solving this would be great. at least it the max width should be configureable, would also help. many thanks

  4. self-assigned this
    on Sep 18, 2020
  5. changed the title [-]Option to allow EuiComboBox dropdown to expand to not truncate options[/-] [+][EuiComboBox] Allow dropdown to expand to not truncate options[/+] on Sep 20, 2020
  6. lizozom commented on Oct 29, 2020

    @lizozom
    Contributor

    Any updates on this by any chance?

  7. chandlerprall commented on Oct 30, 2020

    @chandlerprall
    Contributor

    @cchaos what about something like this?

    combobox_listoption_expansion

  8. cchaos commented on Oct 30, 2020

    @cchaos
    Contributor

    Yeah I've mostly dropped the ball on this because it's actually a harder problem to solve than it seems on the surface.

    @lizozom We'll make sure a solution is done in this minor (7.11)

  9. cjcenizal commented on Oct 30, 2020

    @cjcenizal
    ContributorAuthor

    @chandlerprall I think one issue with that solution could be that it requires "looking with your mouse", instead of your eyes. To get a sense for how that could be a frustrating UX, consider the screenshot in the description but with many fields that share the same stem, e.g. customer_first_name, customer_first_name_raw, customer_first_name_translated_fr, and so on. It'd be time-consuming to hunt through all of them with your mouse in order to find the one you want.

  10. cchaos commented on Nov 3, 2020

    @cchaos
    Contributor

    We're currently looking into a solution that would allow the option labels to wrap, but hinders on the ability from the plugin we use for virtualization. Otherwise a couple solutions we'll also look into are:

    1. Middle truncation
    2. Customizing width of popover

    Most of the solutions will be opt-in, meaning there will still need to be follow up by Kibana. Another piece of this will be that the field selector in Kibana should just be full width of the containing popover instead of 50% and/or extend the width of that popover.

  11. AlonaNadler commented on Nov 17, 2020

    @AlonaNadler

    I got another request from a customer about this issue, they are struggling with selecting the right index pattern in discover. Their index pattern have long names that get truncated. I can't share the screenshot since it contains sensitive information

  12. cchaos commented on Dec 10, 2020

    @cchaos
    Contributor

    With elastic/kibana#85320 merged, this is no longer urgent, but I'm still leaving open in hopes we can find a solution during a refactor to using EuiSelectable.

  13. removed their assignment
    on Dec 10, 2020
  14. github-actions commented on Jun 9, 2021

    @github-actions

    👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment.

  15. added
    stale-issue
    on Jun 9, 2021
  16. cjcenizal commented on Jun 9, 2021

    @cjcenizal
    ContributorAuthor

    Still seems like an issue users will run into, so worth keeping this open?

  17. removed
    stale-issue
    on Jun 10, 2021
  18. wylieconlon commented on Jun 29, 2021

    @wylieconlon

    @cchaos I like the options you suggested of either middle truncation or expanded popover width. Were you suggesting that the combo box should support both options, or that we should pick one as the preferred solution? Would this be something open to a contribution from Lens?

    We recently ran into this in the Lens field list: elastic/kibana#103701

  19. snide commented on Aug 16, 2021

    @snide
    Contributor

    Small note that elastic/kibana#106285 implemented some logic within Lens for this. We might want to consider building this in directly through a truncate prop on the EUI components directly.

  20. daveyholler commented on Mar 27, 2023

    @daveyholler
    Contributor

    Closing this as not-planned and in favor of #5997

  21. JasonStoltz commented on Oct 11, 2023

    @JasonStoltz
    Contributor

    #7246 Introduces a min-width prop that will allow this dropdown to expand independently of the width of the dropdown element, which solves this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions