-
Notifications
You must be signed in to change notification settings - Fork 495
dbeaver/pro#5232 [CB] Trap Focus In the Right Panel #3952
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
base: devel
Are you sure you want to change the base?
dbeaver/pro#5232 [CB] Trap Focus In the Right Panel #3952
Conversation
… focus escaping
… components for improved dialog layout
…t logic from DialogsPortal now handled by ariakit dialog component
…in AuthDialog and DriverSelectorDialog
…alogs component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request introduces a new Dialog component based on AriaKit's WAI-ARIA Dialog Pattern to implement focus trapping in the right panel. The implementation replaces custom focus handling with a library-based solution that provides better accessibility and maintainability.
Key changes:
- Added new Dialog component to ui-kit with support for modal dialogs and slide panels
- Refactored CommonDialogWrapper to use the new Dialog component, simplifying state and focus management
- Updated right panel implementations in Administration and RightArea to use Dialog for focus trapping
Reviewed changes
Copilot reviewed 29 out of 30 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| webapp/yarn.lock | Added dependencies for Storybook addon-storysource and supporting libraries |
| webapp/packages/storybook/package.json | Added @storybook/addon-storysource dependency for viewing component source code |
| webapp/packages/storybook/.storybook/main.ts | Configured the new storysource addon |
| webapp/packages/storybook/src/stories/components/Dialog/dialog.stories.tsx | Comprehensive stories demonstrating Dialog component usage |
| webapp/packages/storybook/src/stories/components/Dialog/Dialog.mdx | Documentation for Dialog component and its variants |
| webapp/common-react/@dbeaver/ui-kit/src/Dialog/Dialog.tsx | New Dialog component wrapping AriaKit with custom styling |
| webapp/common-react/@dbeaver/ui-kit/src/Dialog/Dialog.css | Styling for Dialog component including animations and variants |
| webapp/common-react/@dbeaver/ui-kit/src/Dialog/_base.css | CSS variables for Dialog theming |
| webapp/common-react/@dbeaver/ui-kit/src/index.ts | Exports new Dialog component from ui-kit |
| webapp/packages/core-blocks/src/CommonDialog/DialogsPortal.tsx | Simplified by removing custom focus handling and backdrop logic |
| webapp/packages/core-blocks/src/CommonDialog/DialogsPortal.module.css | Removed unused backdrop styles |
| webapp/packages/core-blocks/src/CommonDialog/CommonDialog/CommonDialogWrapper.tsx | Refactored to use new Dialog component |
| webapp/packages/core-blocks/src/CommonDialog/CommonDialog/CommonDialogWrapper.module.css | Updated styles to work with new Dialog component |
| webapp/packages/core-blocks/src/CommonDialog/CommonDialog/CommonDialogHeader.tsx | Uses DialogHeader from ui-kit |
| webapp/packages/core-blocks/src/CommonDialog/CommonDialog/CommonDialogFooter.tsx | Uses DialogFooter from ui-kit |
| webapp/packages/core-blocks/src/CommonDialog/CommonDialog/CommonDialogBody.tsx | Uses DialogBody from ui-kit |
| webapp/packages/core-blocks/src/Slide/SlideBox.tsx | Removed onClose prop and escape key handling (now handled by Dialog) |
| webapp/packages/core-blocks/src/Slide/SlideOverlay.tsx | Removed close button (now rendered separately) |
| webapp/packages/plugin-administration/src/Administration/Administration.tsx | Wraps OptionsPanel in Dialog for focus trapping |
| webapp/packages/plugin-administration/src/Administration/shared/Administration.module.css | Adds styles for close button |
| webapp/packages/plugin-administration/package.json | Added ui-kit dependency |
| webapp/packages/plugin-administration/tsconfig.json | Added ui-kit reference |
| webapp/packages/core-app/src/AppScreen/RightArea.tsx | Wraps OptionsPanel in Dialog for focus trapping |
| webapp/packages/core-app/src/AppScreen/RightArea.module.css | Adds styles for close button |
| webapp/packages/plugin-connection-custom/src/DriverSelector/DriverSelectorDialog.tsx | Removed autofocus prop (now handled by Dialog) |
| webapp/packages/plugin-authentication/src/Dialog/AuthDialog.tsx | Removed autofocus prop (now handled by Dialog) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
webapp/packages/storybook/src/stories/components/Dialog/Dialog.mdx
Outdated
Show resolved
Hide resolved
webapp/packages/storybook/src/stories/components/Dialog/Dialog.mdx
Outdated
Show resolved
Hide resolved
webapp/packages/storybook/src/stories/components/Dialog/Dialog.mdx
Outdated
Show resolved
Hide resolved
webapp/packages/storybook/src/stories/components/Dialog/Dialog.mdx
Outdated
Show resolved
Hide resolved
webapp/packages/storybook/src/stories/components/Dialog/Dialog.mdx
Outdated
Show resolved
Hide resolved
webapp/packages/storybook/src/stories/components/Dialog/Dialog.mdx
Outdated
Show resolved
Hide resolved
webapp/packages/storybook/src/stories/components/Dialog/Dialog.mdx
Outdated
Show resolved
Hide resolved
webapp/packages/storybook/src/stories/components/Dialog/Dialog.mdx
Outdated
Show resolved
Hide resolved
webapp/packages/core-blocks/src/CommonDialog/CommonDialog/CommonDialogWrapper.module.css
Outdated
Show resolved
Hide resolved
webapp/packages/core-blocks/src/CommonDialog/CommonDialog/CommonDialogWrapper.tsx
Outdated
Show resolved
Hide resolved
…r reach hidden panel
…ent by removing Dialog
…ing in visible part
Screen.Recording.2025-12-05.at.10.25.28.movDialog was removed from SlidePanel implementation, we returned back to manual ESC hotkey handling.
|
…d tsconfig.json
…ui-kit-for-side-panel-to-prevent-focus-escaping-the-panel
Screen.Recording.2025-12-03.at.11.43.31.mov
Screen.Recording.2025-12-03.at.11.45.51.mov
While working with this task I encountered several issues:
I couldn't use FocusTrapRegion on the Panel itself, because components should be open to extension to use it, which we could not guarantee with our design.
I couldn't apply FocusTrapRegion on the SlideElement, because it is used for the static part of the app as well.
Then I tried to use FocusTrapRegion on the SlideBox. It entailed two problems:
Having said that, I decided to use Dialog component from the AriaKit library. This component is based on the WAI-ARIA Dialog Pattern and do everything what we need.
To achieve that I did the following:
Here I came across to another problem: nested dialogs were not showed properly. That was kinda expected, so I just make another bunch of changes:
As a result, CommonDialogWrapper became much more simple. We could delete state and focus handling. We also simplified DialogsPortal component, because AriaKit Dialog can handle all the inner dialog focus movements for us.
I generated a bunch of Stories for storybook. I also added storybook source add-on. It comes in handy when you want to see examples of implementation. No need to search the workspace, you can see the code and how it works right in the storybook.
P.S.
For Right Panel I tried to implement special variant of Dialog, but due to growing complexity of that task and many changes, I stopped myself from changing RightArea logic with SlideBox and SlideElement. If we decide, we want to simplify it and remove carousel, we will be able to use Slide Dialog later.