Giter Club home page Giter Club logo

Comments (6)

1Copenut avatar 1Copenut commented on May 28, 2024 1

@alexwizp Can we use the EuiAccordion - interactive content in trigger guidance to make the outer container a DIV, keep the arrow button, and have the link as a sibling element? We need to retain the arrow button as a visual cue and keyboard hook, and making the wrapper a DIV should remove the issue.

Holler at me if this is not workable or I'm missing context. Thank you!

from eui.

cee-chen avatar cee-chen commented on May 28, 2024 1

Is my question still the same: do we have any technical reason for that condition in the EUI code, or can we remove it?

The reason for that condition is an accessibility/cognition one. Even if not a technical reason, it's still valid and shouldn't be removed as a default.

Now, I will try setting buttonElement="div" according to the guide you provided. In this case, the button is displayed outside the panel, which does not align with the initial design.

This is solvable by not using an EuiPanel but instead adding some custom CSS to the .euiAccordion__triggerWrapper DOM element/wrapper, e.g.:

import { EuiAccordion, euiShadow } from '@elastic/eui';

<EuiAccordion
  buttonElement="div"
  css={(euiThemeContext) => css`
    .euiAccordion__triggerWrapper {
      ${euiShadow(euiThemeContext, 'm')}
      border-radius: ${euiThemeContext.euiTheme.border.radius.medium};
      padding: ${euiThemeContext.euiTheme.size.base};
    }
  `}
  // ... other props
>
  ...
</EuiAccordion>

Example codesandbox here.

While custom CSS is not ideal, in this case it should solve the accessibility issue for now while maintaining the existing design. For a longer term solution, EUI could consider a couple options:

  1. Updating the triggerWrapper element to allow custom props to be passed to it
  2. Adding a custom prop/config, e.g. buttonProps: { hasShadow: true } that automatically adds a panel with shadows and/or allows consumers to configure a shadow on the button/trigger only

from eui.

alexwizp avatar alexwizp commented on May 28, 2024

@cee-chen @1Copenut
In our current design, the buttonContent property for EuiAccordion uses EuiPanel, inside of which there is a trigger arrow EuiButtonIcon. From a design perspective, the button is located inside the panel!

Now, I will try setting buttonElement="div" according to the guide you provided. In this case, the button is displayed outside the panel, which does not align with the initial design.

See:

before:
image

after:
Here I removed our EuiButtonIcon trigger button
image

Is my question still the same: do we have any technical reason for that condition in the EUI code, or can we remove it?

from eui.

1Copenut avatar 1Copenut commented on May 28, 2024

Looking at the description it seems the nesting order needs refactored. @cee-chen stop me if I'm wrong, but wouldn't it make more sense to:

  1. EuiPanel as the outer container
  2. EuiAccordion as a DIV inside the panel
  3. Button, link, and metadata as sibling inline elements in the accordion

from eui.

alexwizp avatar alexwizp commented on May 28, 2024

@1Copenut I would like to focus only on the EuiAccordion component. From the component's API perspective, we have the ability to place any ReactNode in the buttonContent property. The question is: can we use arrowDisplay === "none" in the case where buttonElement is set to div or not?

If you confirm that this case is not supported, I think I can recommend team to move the arrow button from the EuiPanel, like this:
image

from eui.

github-actions avatar github-actions commented on May 28, 2024

👋 This issue hasn't seen activity in 3 days, so we're automatically closing this issue as answered. Please leave a comment if that's not the case, or if you have any remaining questions or issues.

from eui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.