Skip to content

Conversation

@1Copenut
Copy link
Contributor

@1Copenut 1Copenut commented Jan 26, 2022

Summary

Our interactive elements drag and drop pattern had focusable buttons that could not be reached by keyboard, and wouldn't announce to screen readers. We also had a draggable group that was a div[role="button"] which was preventing keyboard navigation. I refactored both patterns to retain the existing visual design as much as possible, and add the needed updates to pass an axe check and improve keyboard and screen reader experience.

Closes #5294

Design change

I made a visual change to the interactive elements pattern by leveraging the custom drag handle. I went this direction to fix a nested focusable element error. If the container will receive keyboard focus, the interactive element(s) will not be usable by keyboard events, and will not be announced to screen readers. I am attaching a screenshot of my proposed change below, and happy to make changes to visual design as needed.

Checklist

  • Check against all themes for compatibility in both light and dark modes
  • Checked in mobile
  • Checked in Chrome, Safari, Edge, and Firefox
  • Props have proper autodocs and playground toggles
  • Added documentation
  • Checked Code Sandbox works for any docs examples
  • Added or updated jest and cypress tests
  • Checked for breaking changes and labeled appropriately
  • Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

Screen Shot 2022-01-28 at 8 23 55 AM

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5568/

1Copenut added 2 commits January 27, 2022 10:00
* Adding documentation for custom and interactive patterns props.
* Adding changelog entry.
@1Copenut 1Copenut marked this pull request as ready for review January 27, 2022 16:06
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5568/

@cee-chen
Copy link
Contributor

cee-chen commented Jan 27, 2022

QA looks great to me, and I personally strongly prefer the cognitive separation of the drag handle vs. the buttons on the "Interactive elements" demo 👏

Code generally looks good - my blocking change requests are around ensuring we add unit tests for the new props, and not adding demo-specific CSS to our source code.

@thompsongl
Copy link
Contributor

personally strongly prefer the cognitive separation of the drag handle vs. the buttons on the "Interactive elements" demo 👏

Agreed!

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5568/

@1Copenut 1Copenut requested a review from cee-chen January 27, 2022 22:53
Comment on lines 51 to 52
<EuiPanel className="custom" paddingSize="m">
<EuiFlexGroup alignItems="center" gutterSize="l">
Copy link
Contributor

Choose a reason for hiding this comment

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

Super visual minor spacing suggestions, I think this brings it back closer to what it looked like originally. Feel free to wait for @miukimiu on this one though

Suggested change
<EuiPanel className="custom" paddingSize="m">
<EuiFlexGroup alignItems="center" gutterSize="l">
<EuiPanel className="custom" paddingSize="s">
<EuiFlexGroup alignItems="center" gutterSize="m">

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a new screenshot in the description to highlight this change.

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5568/

@1Copenut 1Copenut requested a review from cee-chen January 28, 2022 14:25
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5568/

Copy link
Contributor

@cee-chen cee-chen left a comment

Choose a reason for hiding this comment

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

Woohoo, thanks for the responsiveness and feedback rounds! This looks awesome. @miukimiu, did you want to take a look at this before merging?

Copy link
Contributor

@elizabetdev elizabetdev left a comment

Choose a reason for hiding this comment

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

Thanks, @1Copenut! The PR is looking good! 🎉

I tested in Chrome, Safari, Firefox, and it works well! 👍🏽

I have a few suggestions below.

Let me know if there's any problem on replacing the <div {...provided.dragHandleProps} /> with a <EuiPanel {...provided.dragHandleProps} />. If not, I think visually it would look better.

If we go for this suggested change I would also consider changing the Custom drag handle example to use the <EuiPanel /> instead of a <div />. So both examples, Custom drag handle and Interactive elements would have similar elements.

Comment on lines 52 to 56
<EuiFlexGroup alignItems="center" gutterSize="m">
<EuiFlexItem grow={false}>
<div {...provided.dragHandleProps} aria-label="Drag Handle">
<EuiIcon type="grab" />
</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest using a transparent EuiPanel with a padding instead of a div.

  • This would give us a bigger size draggable area.
  • It would ensure more consistent spacing between the icon and the button.
Suggested change
<EuiFlexGroup alignItems="center" gutterSize="m">
<EuiFlexItem grow={false}>
<div {...provided.dragHandleProps} aria-label="Drag Handle">
<EuiIcon type="grab" />
</div>
<EuiFlexGroup alignItems="center" gutterSize="s">
<EuiFlexItem grow={false}>
<EuiPanel
color="transparent"
paddingSize="s"
{...provided.dragHandleProps}
aria-label="Drag Handle"
>
<EuiIcon type="grab" />
</EuiPanel>

Frame 16@2x

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you @miukimiu! These suggestions were easy to implement, and made the button hit space larger and more consistent. Ready for next review.

{content}
</EuiButton>
{(provided) => (
<EuiPanel className="custom" paddingSize="s">
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the className "custom" necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I took a few passes adding/removing the "custom" class and can't see any difference. I'll go ahead and remove it as part of the next code push.

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5568/

@1Copenut 1Copenut requested a review from elizabetdev January 28, 2022 19:57
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5568/

Copy link
Contributor

@elizabetdev elizabetdev left a comment

Choose a reason for hiding this comment

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

Thanks, @1Copenut for making the changes.

I tested again in Safari, Chrome, and Firefox. I also looked at the code changes and LGTM! 🎉

@1Copenut 1Copenut merged commit f357404 into elastic:main Jan 31, 2022
@1Copenut 1Copenut deleted the feature/tpierce-eui-5294-dnd branch January 31, 2022 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[EuiDragAndDrop][AXE-CORE]: Nested drag and drop buttons will not be announced by screen readers

5 participants