-
Notifications
You must be signed in to change notification settings - Fork 1
feat: ViewConfigPanel responsive overlay, ARIA accessibility, auto-close on view switch #663
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ | |
| * following the same pattern as MetadataPanel. | ||
| */ | ||
|
|
||
| import { useMemo } from 'react'; | ||
| import { useMemo, useEffect, useRef } from 'react'; | ||
| import { Button } from '@object-ui/components'; | ||
| import { X, ChevronRight } from 'lucide-react'; | ||
| import { useObjectTranslation } from '@object-ui/i18n'; | ||
|
|
@@ -96,6 +96,14 @@ function ToggleIndicator({ enabled }: { enabled: boolean }) { | |
|
|
||
| export function ViewConfigPanel({ open, onClose, activeView, objectDef }: ViewConfigPanelProps) { | ||
| const { t } = useObjectTranslation(); | ||
| const panelRef = useRef<HTMLDivElement>(null); | ||
|
|
||
| // Focus the panel when it opens for keyboard accessibility | ||
| useEffect(() => { | ||
| if (open && panelRef.current) { | ||
| panelRef.current.focus(); | ||
| } | ||
| }, [open]); | ||
|
Comment on lines
+101
to
+106
|
||
|
|
||
| const viewLabel = activeView.label || activeView.id; | ||
| const viewType = activeView.type || 'grid'; | ||
|
|
@@ -124,8 +132,12 @@ export function ViewConfigPanel({ open, onClose, activeView, objectDef }: ViewCo | |
|
|
||
| return ( | ||
| <div | ||
| ref={panelRef} | ||
| data-testid="view-config-panel" | ||
| className="w-72 lg:w-80 border-l bg-background flex flex-col shrink-0 z-20 transition-all overflow-hidden" | ||
| role="complementary" | ||
| aria-label={t('console.objectView.configureView')} | ||
| tabIndex={-1} | ||
| className="absolute inset-y-0 right-0 w-full sm:w-72 lg:w-80 sm:relative sm:inset-auto border-l bg-background flex flex-col shrink-0 z-20 transition-all overflow-hidden" | ||
| > | ||
| {/* Panel Header */} | ||
| <div className="px-4 py-3 border-b flex items-center justify-between shrink-0"> | ||
|
|
||
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.
The auto-close behavior when switching views is not covered by tests. Consider adding a test in ViewSwitching.test.tsx or ObjectView.test.tsx to verify that showViewConfigPanel is set to false when handleViewChange is called. This ensures the panel closes automatically when users switch between views, which is an important UX behavior mentioned in the PR description.