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

[EuiAccordion] Do not set arrowDisplay to none if the buttonElement is a div. #7545

Closed
alexwizp opened this issue Feb 28, 2024 · 6 comments
Closed
Labels
accessibility answered Issues answered by the EUI team - auto-closes open issues in 7 days if no follow-up response question

Comments

@alexwizp
Copy link
Contributor

To address the accessibility issue described in https://github.com/elastic/security-team/issues/8611 , we intended to set the buttonElement to div and hide the default arrow by setting arrowDisplay to none. However, this approach is ineffective because the arrowDisplay option only works when buttonElement is set to button.

EUI code:

image

Our layout:

image

Please provide advice on how to resolve this issue.

@1Copenut
Copy link
Contributor

1Copenut commented Mar 4, 2024

@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!

@cee-chen cee-chen added accessibility answered Issues answered by the EUI team - auto-closes open issues in 7 days if no follow-up response labels Mar 4, 2024
@alexwizp
Copy link
Contributor Author

alexwizp commented Mar 4, 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?

@1Copenut
Copy link
Contributor

1Copenut commented Mar 4, 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

@alexwizp
Copy link
Contributor Author

alexwizp commented Mar 4, 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

@cee-chen
Copy link
Contributor

cee-chen commented Mar 4, 2024

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

@github-actions github-actions bot removed the answered Issues answered by the EUI team - auto-closes open issues in 7 days if no follow-up response label Mar 5, 2024
@cee-chen cee-chen added the answered Issues answered by the EUI team - auto-closes open issues in 7 days if no follow-up response label Mar 11, 2024
alexwizp added a commit to elastic/kibana that referenced this issue Mar 14, 2024
… must not be nested (#178023)

Closes: elastic/security-team#8611

## Description

The [axe browser plugin](https://deque.com/axe) is reporting a nested
button (interactive control)in the shared exception list accordion(s).
The accordion has a button to open/close and a link to the list detail
view. Screenshot attached below.

### Steps to recreate

1. Open the Security Dashboards, then click Rules > Shared Exception
Lists
2. Run an axe browser scan in Chrome, Edge, or Firefox
3. Verify the nested control error

### What was done? 

1. Solution proposed by EUI team was applied. See
elastic/eui#7545
2. The component `ExceptionsListCard` has been slightly changed to make
it more responsive.
       Before: 

       After: 


https://github.com/elastic/kibana/assets/20072247/dd6c6681-980c-40ed-98cf-29a71f896bc2




### Screen

#### AXE Report 


![image](https://github.com/elastic/kibana/assets/20072247/43313005-b7ec-49d1-9eed-30bfacbb5ecc)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue Mar 14, 2024
… must not be nested (elastic#178023)

Closes: elastic/security-team#8611

## Description

The [axe browser plugin](https://deque.com/axe) is reporting a nested
button (interactive control)in the shared exception list accordion(s).
The accordion has a button to open/close and a link to the list detail
view. Screenshot attached below.

### Steps to recreate

1. Open the Security Dashboards, then click Rules > Shared Exception
Lists
2. Run an axe browser scan in Chrome, Edge, or Firefox
3. Verify the nested control error

### What was done?

1. Solution proposed by EUI team was applied. See
elastic/eui#7545
2. The component `ExceptionsListCard` has been slightly changed to make
it more responsive.
       Before:

       After:

https://github.com/elastic/kibana/assets/20072247/dd6c6681-980c-40ed-98cf-29a71f896bc2

### Screen

#### AXE Report

![image](https://github.com/elastic/kibana/assets/20072247/43313005-b7ec-49d1-9eed-30bfacbb5ecc)

(cherry picked from commit b90e215)
kibanamachine added a commit to elastic/kibana that referenced this issue Mar 14, 2024
…e controls must not be nested (#178023) (#178754)

# Backport

This will backport the following commits from `main` to `8.13`:
- [fix: [Rules &gt; Shared exception lists][AXE-CORE]: Interactive
controls must not be nested
(#178023)](#178023)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Alexey
Antonov","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-03-14T16:02:50Z","message":"fix:
[Rules > Shared exception lists][AXE-CORE]: Interactive controls must
not be nested (#178023)\n\nCloses:
https://github.com/elastic/security-team/issues/8611\r\n\r\n##
Description\r\n\r\nThe [axe browser plugin](https://deque.com/axe) is
reporting a nested\r\nbutton (interactive control)in the shared
exception list accordion(s).\r\nThe accordion has a button to open/close
and a link to the list detail\r\nview. Screenshot attached
below.\r\n\r\n### Steps to recreate\r\n\r\n1. Open the Security
Dashboards, then click Rules > Shared Exception\r\nLists\r\n2. Run an
axe browser scan in Chrome, Edge, or Firefox\r\n3. Verify the nested
control error\r\n\r\n### What was done? \r\n\r\n1. Solution proposed by
EUI team was applied.
See\r\nhttps://github.com/elastic/eui/issues/7545\r\n2. The component
`ExceptionsListCard` has been slightly changed to make\r\nit more
responsive.\r\n Before: \r\n\r\n After:
\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/20072247/dd6c6681-980c-40ed-98cf-29a71f896bc2\r\n\r\n\r\n\r\n\r\n###
Screen\r\n\r\n#### AXE Report
\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/20072247/43313005-b7ec-49d1-9eed-30bfacbb5ecc)","sha":"b90e215d9b4a1462c8cb3be692bcc44edda1e6b8","branchLabelMapping":{"^v8.14.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Detections
and Resp","Team: SecuritySolution","Feature:Rule
Exceptions","Team:Detection Engine","v8.13.0","v8.14.0"],"title":"fix:
[Rules > Shared exception lists][AXE-CORE]: Interactive controls must
not be
nested","number":178023,"url":"https://github.com/elastic/kibana/pull/178023","mergeCommit":{"message":"fix:
[Rules > Shared exception lists][AXE-CORE]: Interactive controls must
not be nested (#178023)\n\nCloses:
https://github.com/elastic/security-team/issues/8611\r\n\r\n##
Description\r\n\r\nThe [axe browser plugin](https://deque.com/axe) is
reporting a nested\r\nbutton (interactive control)in the shared
exception list accordion(s).\r\nThe accordion has a button to open/close
and a link to the list detail\r\nview. Screenshot attached
below.\r\n\r\n### Steps to recreate\r\n\r\n1. Open the Security
Dashboards, then click Rules > Shared Exception\r\nLists\r\n2. Run an
axe browser scan in Chrome, Edge, or Firefox\r\n3. Verify the nested
control error\r\n\r\n### What was done? \r\n\r\n1. Solution proposed by
EUI team was applied.
See\r\nhttps://github.com/elastic/eui/issues/7545\r\n2. The component
`ExceptionsListCard` has been slightly changed to make\r\nit more
responsive.\r\n Before: \r\n\r\n After:
\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/20072247/dd6c6681-980c-40ed-98cf-29a71f896bc2\r\n\r\n\r\n\r\n\r\n###
Screen\r\n\r\n#### AXE Report
\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/20072247/43313005-b7ec-49d1-9eed-30bfacbb5ecc)","sha":"b90e215d9b4a1462c8cb3be692bcc44edda1e6b8"}},"sourceBranch":"main","suggestedTargetBranches":["8.13"],"targetPullRequestStates":[{"branch":"8.13","label":"v8.13.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.14.0","branchLabelMappingKey":"^v8.14.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/178023","number":178023,"mergeCommit":{"message":"fix:
[Rules > Shared exception lists][AXE-CORE]: Interactive controls must
not be nested (#178023)\n\nCloses:
https://github.com/elastic/security-team/issues/8611\r\n\r\n##
Description\r\n\r\nThe [axe browser plugin](https://deque.com/axe) is
reporting a nested\r\nbutton (interactive control)in the shared
exception list accordion(s).\r\nThe accordion has a button to open/close
and a link to the list detail\r\nview. Screenshot attached
below.\r\n\r\n### Steps to recreate\r\n\r\n1. Open the Security
Dashboards, then click Rules > Shared Exception\r\nLists\r\n2. Run an
axe browser scan in Chrome, Edge, or Firefox\r\n3. Verify the nested
control error\r\n\r\n### What was done? \r\n\r\n1. Solution proposed by
EUI team was applied.
See\r\nhttps://github.com/elastic/eui/issues/7545\r\n2. The component
`ExceptionsListCard` has been slightly changed to make\r\nit more
responsive.\r\n Before: \r\n\r\n After:
\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/20072247/dd6c6681-980c-40ed-98cf-29a71f896bc2\r\n\r\n\r\n\r\n\r\n###
Screen\r\n\r\n#### AXE Report
\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/20072247/43313005-b7ec-49d1-9eed-30bfacbb5ecc)","sha":"b90e215d9b4a1462c8cb3be692bcc44edda1e6b8"}}]}]
BACKPORT-->

Co-authored-by: Alexey Antonov <[email protected]>
Copy link

👋 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility answered Issues answered by the EUI team - auto-closes open issues in 7 days if no follow-up response question
Projects
None yet
Development

No branches or pull requests

3 participants