Skip to content

feat: add direct resize handle to item selector drawer #30

@smartlabsAT

Description

@smartlabsAT

Feature Description

Implement a direct resize handle for the item selector drawer that allows users to resize the drawer by dragging, without needing to open a menu or use preset sizes.

Current Behavior

  • Users must open a menu to select from preset drawer sizes
  • No direct manipulation of drawer width
  • Switching between sizes requires multiple clicks
  • Limited flexibility in drawer sizing

Expected Behavior

  • Visible resize handle on the drawer edge (left side)
  • Click and drag to resize the drawer smoothly
  • Visual feedback during resizing (cursor change, highlight)
  • Remember user's preferred size per session
  • Minimum and maximum width constraints

Implementation Details

1. Resize Handle Component

  • Vertical bar/grip on the left edge of the drawer
  • Hover state with visual indication
  • Cursor changes to col-resize on hover

2. Drag Behavior

  • Mouse down initiates resize
  • Track mouse movement to adjust width
  • Update drawer width in real-time
  • Respect min-width (e.g., 400px) and max-width (e.g., 90vw)

3. Technical Implementation

// Example approach
const handleMouseDown = (e: MouseEvent) => {
  const startX = e.clientX;
  const startWidth = drawerWidth.value;
  
  const handleMouseMove = (e: MouseEvent) => {
    const diff = startX - e.clientX;
    const newWidth = Math.max(minWidth, Math.min(maxWidth, startWidth + diff));
    drawerWidth.value = newWidth;
  };
  
  const handleMouseUp = () => {
    document.removeEventListener('mousemove', handleMouseMove);
    document.removeEventListener('mouseup', handleMouseUp);
  };
  
  document.addEventListener('mousemove', handleMouseMove);
  document.addEventListener('mouseup', handleMouseUp);
};

4. User Experience

  • Smooth resizing without lag
  • Optional: Snap to certain widths
  • Optional: Double-click handle to toggle between last size and default
  • Persist size preference in localStorage

Benefits

  • Improved UX: Direct manipulation is more intuitive
  • Efficiency: Faster workflow without menu interactions
  • Flexibility: Users can set exact width for their needs
  • Modern UI: Aligns with modern UI patterns

Acceptance Criteria

  • Resize handle is visible and accessible
  • Dragging handle smoothly resizes drawer
  • Width constraints are enforced
  • No performance issues during resize
  • Works across all supported browsers
  • Keyboard accessibility considered

Additional Considerations

  • Touch device support (optional)
  • Accessibility for keyboard users
  • Performance optimization for smooth resizing
  • Integration with existing drawer component

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestitem-selectorRelated to the item selector component

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions