Skip to content

Latest commit

 

History

History
83 lines (63 loc) · 2.9 KB

File metadata and controls

83 lines (63 loc) · 2.9 KB

PortCard Text Overflow Fix - Summary

Problem

When the process name is too long, it pushes the 3 action buttons (favorite, quick launch, close) out of the card, breaking the layout.

Solution Implemented

1. CSS Changes (PortCard.css)

.port-card-main-info

  • Changed flex-wrap from wrap to nowrap to prevent unwanted wrapping
  • Added flex: 1 to make it take available space
  • Added min-width: 0 to allow flex items to shrink properly

.port-number

  • Added flex-shrink: 0 to keep it fixed width
  • Added white-space: nowrap to prevent wrapping

.port-process-name

  • Added flex: 1 to make it take available space
  • Added min-width: 0 to allow it to shrink
  • Added max-width: 200px to prevent it from taking all space
  • Added overflow: hidden to hide overflow
  • Added text-overflow: ellipsis to show ellipsis (...) for truncated text
  • Added white-space: nowrap to prevent wrapping
  • Added word-wrap: break-word for word wrapping
  • Added overflow-wrap: break-word for overflow wrapping
  • Added word-break: break-word for word breaking

.status-badge

  • Added flex-shrink: 0 to keep it fixed width
  • Added white-space: nowrap to prevent wrapping

.port-card-actions

  • Added flex-shrink: 0 to keep it fixed width
  • Added align-items: center for proper alignment

.port-card-header

  • Added width: 100% to ensure it takes full width

2. Responsive Design Updates

@media (max-width: 768px)

  • Added width: 100% to .port-card-main-info
  • Changed flex-wrap to wrap for better mobile layout
  • Reduced max-width of .port-process-name to 150px

@media (max-width: 480px)

  • Changed .port-card-main-info to flex-direction: column
  • Set .port-process-name max-width to 100% and width to 100%

3. Component Changes (PortCard.jsx)

Added title attribute to the process name span:

<span className="port-process-name" title={port.processName || 'Unknown Process'}>
  {port.processName || 'Unknown Process'}
</span>

This provides a tooltip so users can see the full process name when hovering over truncated text.

Benefits

  1. Text Wrapping: Long process names now properly wrap and truncate with ellipsis
  2. Layout Stability: Action buttons stay within card boundaries regardless of process name length
  3. User Experience: Tooltip shows full process name on hover
  4. Responsive: Works properly on all screen sizes
  5. Flexbox Optimization: Proper flex properties ensure correct spacing and alignment

Testing

A test HTML file (test_portcard.html) has been created to verify the fix with:

  • Normal process names
  • Long process names
  • Very long process names
  • Multiple cards with different lengths

The test demonstrates that:

  • Process names truncate with ellipsis when too long
  • Action buttons stay in position
  • Full process name is visible on hover
  • Layout remains stable across different name lengths