Skip to content

[EuiPopover] Both hasShadow and hasBorder are ignored in panelProps #6832

Closed

Description

@Heenawter

Describe the bug
When giving hasShadow and/or hasBorder to the popover panel via the panelProps prop, you don't get the expected results. For example, when giving panelProps={{ hasShadow: false }} as a prop to EuiPopover...

Actual Expected
image image

Environment and versions

  • EUI version: 81.0.0
  • Browser: Chrome

To Reproduce
Steps to reproduce the behavior:

  1. Create an EuiPopover component and add panelProps={{ hasShadow: false }} as a prop
  2. Open the popover and notice that the shadow is still present 🔥

and/or...

  1. Create an EuiPopover component and add panelProps={{ hasBorder: true }} as a prop
  2. Open the popover and notice that the panel does not have a border 🔥

Minimum reproducible sandbox
https://codesandbox.io/s/vibrant-tree-wc5i7g?file=/demo.js

Activity

  1. added
    ⚠️ needs validation
    on Jun 5, 2023
  2. cee-chen commented on Jun 5, 2023

    @cee-chen
    Contributor

    @ryankeairns can you chime in on whether this is a deliberate design decision? To be honest I would assume so as the contrast in the popover's visuals is insufficient otherwise.

  3. 1Copenut commented on Jun 5, 2023

    @1Copenut
    Contributor

    FWIW I'm in favor of keeping the shadow. Removing it creates a non-text contrast failure where the light blue and white have a contrast ratio less than 3:1. I'm not 100% sure the shadow does either, but it's much clearer the differentiation between EuiPopover and the background.

    SC 1.4.11: Non-text Contrast (Level AA)

  4. Heenawter commented on Jun 5, 2023

    @Heenawter
    ContributorAuthor

    Just for some context, I wanted to be able to add my own shadow so that I could try to match the styling of the popover used in the EuiDualRange component. Specifically, I wanted to both (1) hide the arrow for the popover and (2) not show the shadow at the top of the panel so that I could make my own EuiPopover to match the following:

    image

    IMO, it is a bit confusing that the popover component accepts hasShadow and hasBorder (which are both available via the EuiPanel component) if they are just going to be ignored :)

  5. cee-chen commented on Jun 5, 2023

    @cee-chen
    Contributor

    We would almost certainly Omit the shadow/border props for panelProps via TS rather than add support. Which we certainly can/should do (if Ryan confirms the intentionality of the design) - it's an oversight that we didn't exclude them in the first place.

    Based on the example you've given, I would strongly suggest using EuiInputPopover rather than try to recreate EUI components from scratch. If you could describe the custom popover usage you're going for, we can help a little more (recommendations on CSS utilities/overrides) etc.

  6. Heenawter commented on Jun 5, 2023

    @Heenawter
    ContributorAuthor

    Well, it's a bit of a long story hahah :)

    I am trying to fix some known a11y concerns with the range slider control - originally, I thought I could do this by switching over to the EuiDualRange component but, upon further investigation, this was not possible due to the following two reasons:

    1. Notice in the following screenshot that (a) the current popover for the range slider has a title and (b) we added an erase icon that will clear the user’s selections:

      image

      Because the consumer doesn't have control over how the EuiDualRange popover looks, I unfortunately had no way of adding these two things.

    2. You cannot add an arrow/anchor to the popover when using EuiDualRange - our options list control currently uses an arrow so ideally we would want the range slider to match:

      image

    To try to get around (2), I was exploring (very loosely) the idea of removing the arrow from the options list control and making the styling match the EuiDualRange popover - however, when trying to add my own styling, I caught the fact that hasShadow was being ignored and assumed it was a bug. If we did decide to go this route, I think you're right that using EuiInputPopover might be the right call.

    However, because of (1) above, I am ultimately locked out of using EuiDualRange anyway - so I'm proceeding with using EuiFormControlLayoutDelimited instead for the range slider control ATM. So if you decide to simply omit hasShadow and hasBorder from panelProps that makes total sense to me as a fix!

  7. cee-chen commented on Jun 5, 2023

    @cee-chen
    Contributor

    Super interesting use case - thanks for diving into more detail!

    To be honest, I would argue both the components listed should be using EuiInputPopover, since they're originating from inputs/form controls - neither should have an arrow displayed.

    @ryankeairns I know the 2nd OS screenshot is a custom Kibana implementation of EuiSelectable - you've mentioned it several times now. I think we should consider bringing it back into EUI for more UI/UX consistency. Thoughts?

  8. ryankeairns commented on Jun 7, 2023

    @ryankeairns
    Contributor

    Apologies for the delayed reply. Now, I'll confirm and +1 where you all ended up :)

    Yes, it was a design decision and yes we should have omitted these props for popovers.

    +1 to not displaying arrows (i.e. instead, use EuiInputPopover) when opening from an input. Coincidentally, I ran into this in Kibana just yesterday and had a similar reaction - it looked and felt odd.

    +1 to bringing those EuiSelectable enhancements into EUI. That idea was captured here and is awaiting triage.

  9. added and removed
    ⚠️ needs validation
    on Jun 8, 2023
  10. self-assigned this
    on Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions