eui
eui copied to clipboard
[EuiResizableContainer] Add resizable container callbacks
Summary
This PR adds support for onResizeStart and onResizeEnd callback props to EuiResizableContainer. The callbacks support resizing with a pointer or a keyboard, and a trigger: 'pointer' | 'key' parameter is passed to onResizeStart indicating which action triggered the resize.
Notes:
- For pointers,
onResizeStartis called onmousedown, andonResizeEndis called onmouseupormouseleave. - For keyboards,
onResizeStartis called only on the firstkeydownevent while the key remains pressed, andonResizeEndis called onkeyup. Tapping an arrow key repeatedly will calledonResizeStartandonResizeEndonce for each tap. - If an arrow key is pressed while a pointer resize is in progress,
onResizeEndis called to signal the end of the pointer resize beforeonResizeStart('key')is called to signal the start of the keyboard resize. - If the opposite arrow key is pressed while a keyboard resize is in progress,
onResizeEndis called to signal the end of the previous keyboard resize beforeonResizeStart('key')is called to signal the start of the current keyboard resize. After changing resize directions, releasing the previous key will not callonResizeEndagain since it would signal the end of the current keyboard resize. - The related issue mentions potentially adding support for similar events to
EuiResizablePanel, but I didn't get around to that in this PR.
(The GIF makes it look like some taps are missed due to the frame rate, but this should not actually happen)

Resolves #6225.
Checklist
- [x] Checked in both light and dark modes
- [x] Checked in mobile
- [x] Checked in Chrome, Safari, Edge, and Firefox
- [ ] Props have proper autodocs and playground toggles
- [x] Added documentation
- [ ] Checked Code Sandbox works for any docs examples
- [x] Added or updated jest and cypress tests
- [x] Checked for breaking changes and labeled appropriately
- [x] Checked for accessibility including keyboard-only and screenreader modes
- [ ] Updated the Figma library counterpart
- [x] A changelog entry exists and is marked appropriately
Preview documentation changes for this PR: https://eui.elastic.co/pr_6236/
Preview documentation changes for this PR: https://eui.elastic.co/pr_6236/
Preview documentation changes for this PR: https://eui.elastic.co/pr_6236/
Preview documentation changes for this PR: https://eui.elastic.co/pr_6236/
Preview documentation changes for this PR: https://eui.elastic.co/pr_6236/
Preview documentation changes for this PR: https://eui.elastic.co/pr_6236/
Preview documentation changes for this PR: https://eui.elastic.co/pr_6236/
That was my last set of comments, I promise! :)
Preview documentation changes for this PR: https://eui.elastic.co/pr_6236/
Preview documentation changes for this PR: https://eui.elastic.co/pr_6236/
jenkins test this
Preview documentation changes for this PR: https://eui.elastic.co/pr_6236/
Preview documentation changes for this PR: https://eui.elastic.co/pr_6236/
Looks great! Feel free to hit merge on this! :tada: