Elevating User Experience: A Journey Through UI/UX and Accessibility Refinements in Artesanos-ar

Even the most visually appealing applications can fall short if they're not accessible, consistent, and responsive across all devices. In the Artesanos-ar project, our focus shifted to a comprehensive overhaul of core UI components and interactions, aiming to deliver a superior experience for every user, regardless of their device or assistive technologies.

The Situation

Like many evolving web applications, Artesanos-ar faced growing pains. Components, while functional, lacked a unified design system. Accessibility, while considered, wasn't deeply integrated into every interaction. And as mobile usage surged, some forms and layouts struggled to maintain optimal usability. This created a fractured experience, requiring developers to write custom solutions for common UI patterns and leaving users occasionally frustrated by inconsistencies or navigation challenges.

The Evolution of Components

To address inconsistencies and enhance usability, we initiated a significant refactoring of our fundamental UI elements. This involved expanding the Button component with new danger and sm variants, providing more granular control over visual feedback and sizing for critical actions and compact layouts. A new, shared Select component was introduced, mirroring the robust API of our Input fields. This ensures a consistent approach to form controls, leveraging React's useId hook for proper label-select association and integrating aria-invalid and aria-describedby for enhanced semantic meaning.

import React, { useId } from 'react';

function SharedSelect({ label, options, value, onChange, isInvalid, errorId }) {
  const selectId = useId();
  const describedBy = isInvalid ? errorId : undefined;

  return (
    <div className="form-group">
      <label htmlFor={selectId}>{label}</label>
      <select
        id={selectId}
        value={value}
        onChange={onChange}
        aria-invalid={isInvalid}
        aria-describedby={describedBy}
        className="form-control"
      >
        {options.map(option => (
          <option key={option.value} value={option.value}>
            {option.label}
          </option>
        ))}
      </select>
      {isInvalid && errorId && (
        <p id={errorId} className="error-message">
          This field is required.
        </p>
      )}
    </div>
  );
}

This SharedSelect component demonstrates how standardizing form elements with proper ARIA attributes and unique IDs (via useId) significantly improves both developer experience and accessibility.

We also overhauled the MobileDrawer component to include a true focus trap. This critical accessibility feature ensures that when a drawer or modal is open, keyboard navigation (Tab/Shift+Tab) is constrained within its boundaries. Pressing Escape correctly closes the drawer and restores focus to the element that triggered it, creating an intuitive and predictable experience for keyboard users.

A Deeper Dive into Accessibility

Beyond components, accessibility became a pervasive consideration. Key interactive elements, such as the Navbar's toggle buttons and photo viewer/remover icons, received explicit aria-label attributes, providing clear context to screen reader users where visual cues alone might be insufficient. Content that was purely decorative or redundant for screen readers was marked aria-hidden. Furthermore, dynamic feedback messages, like those confirming an action or indicating a status, now utilize role=alert or role=status to ensure they are immediately announced to assistive technologies, keeping all users informed of changes on the page.

Responsive Design as a Core Principle

Recognizing the diverse landscape of user devices, responsive design was treated not as an afterthought but as a core principle. We introduced grid-1-mobile to ensure that complex layouts, particularly in sections like MisClientes, MisCupones, MiPerfil, and EventoForm, gracefully collapsed into single-column layouts on smaller screens. Forms, especially in AdminCargarPieza and MisPiezas, were completely rewritten to leverage our new Input and Select components, adopting a mobile-first hierarchy where buttons expanded to full width, simplifying interaction on touch devices.

Architectural Refinements and Maintainability

To ensure long-term maintainability and design consistency, we systematically migrated hardcoded color values to CSS variables. For instance, specific hex codes like #f5b94f55 were replaced with color-mix functions utilizing var(--color-premium). This centralizes our styling, making it easier to manage themes, implement dark modes, or make global design changes from a single source of truth, rather than hunting down disparate hex values across the codebase.

The Technical Lesson (Yes, There Is One)

The biggest lesson from this refactoring effort is that robust UI/UX isn't just about aesthetics; it's about thoughtful engineering. Investing in shared, accessible components, implementing comprehensive responsive strategies, and standardizing styling practices leads to a more maintainable codebase and a significantly better experience for all users. These aren't isolated tasks but interconnected aspects of building a mature, user-centric application.

The Takeaway

Prioritizing UI consistency, comprehensive accessibility, and truly responsive design transforms an application from merely functional to truly exceptional. For developers, it means less repetitive work and a clearer component architecture. For users of Artesanos-ar, it means a more intuitive, inclusive, and enjoyable journey, demonstrating that attention to detail in these areas pays dividends in user satisfaction and product longevity.


Generated with Gitvlg.com

Elevating User Experience: A Journey Through UI/UX and Accessibility Refinements in Artesanos-ar
NICOLÁS SOBRERO

NICOLÁS SOBRERO

Author

Share: