A Practical Web Accessibility (A11y) Guide for SI Publishers

A Practical Web Accessibility (A11y) Guide for SI Publishers

-From Component Markup to Focus Control-

1. Introduction: Accessibility Differences Between Static HTML and React Environments

As the markup environment for SI (System Integration) projects shifts from JSP and static HTML to React- and Vue-based SPA (Single Page Application) structures, one of the biggest technical challenges faced by publishers is web accessibility (Web Accessibility, A11y) quality certification audits.

In static markup environments, most certification criteria could be satisfied by correctly writing semantic tags according to web standards and passing validation. However, in React environments rendered based on a virtual DOM and dynamic state, the following accessibility defects are frequently identified even when markup is written to the same standard.

  • When a modal layer popup is activated, the keyboard Tab focus escapes into the background content.

  • Even though the screen content has been updated through routing, the screen reader does not recognize the change and remains silent.

  • An accordion panel opens when a button is clicked, but the open/closed state is not conveyed verbally to assistive devices.

  • When styles are applied to an icon-only button, the screen reader skips the text hidden by those styles entirely.

Most SI projects concentrate web accessibility quality certification inspections in October and November, before their year-end launches. If defects in focus control or ARIA attribute integration occur during this period, they require changes not only to the markup but also to the component's state design, resulting in serious delivery delays.

Therefore, the work of incorporating essential rules into the markup must be completed from the component development stage onward.

2. Essential Accessibility Syntax Rules in the React JSX Environment

Because React's JSX (JavaScript XML) creates virtual DOM objects instead of directly manipulating the browser DOM, you must understand the clear syntactic differences from standard HTML authoring.

2.1. Retaining Hyphens (kebab-case) in aria-* Attributes

In JSX, most HTML attributes are written in camel case to prevent conflicts with reserved words(className, htmlFor, tabIndex). However, aria-* attributes defined by the WAI-ARIA specification and data-* attributes must retain their hyphenated form (kebab-case) to comply with web standards. If they are incorrectly written in camel case, the browser considers them invalid attributes, preventing screen readers from interpreting them.

// ❌ 잘못된 작성 방식: 속성명 오타 및 role 남발
<div tabindex="0" role="button" ariaHidden="false" onClick={handleClick}>
  상세 보기
</div>

// ⭕ 올바른 작성 방식: 네이티브 버튼 태그 및 웹 표준 하이픈 표기
<button type="button" tabIndex={0} aria-hidden="false" onClick={handleClick}>
  상세 보기
</button>

When you use the <button> tag, keyboard interactions with the Enter and Space keys are natively supported by the browser engine, so there is no need to implement separate keyboard event listeners for a <div> tag.

2.2. Preventing Unnecessary <div> Wrappers and Breaks in Semantic Structure

React components must return a single root node. If you conventionally wrap the top level of a component in <div className="wrapper">, the semantic hierarchy is damaged.

In particular, if <li> is not a direct child of <ul> or <ol>, or if <dt> and <dd> are not direct children of <dl> because a <div> intervenes, the screen reader cannot correctly calculate the total number of list items and the current position.

// ❌ <ul> 직하위에 <div>가 끼어들어 리스트 시맨틱이 단절된 형태
const Breadcrumb = () => (
  <ul className="breadcrumb">
    <div className="inner">
      <li>홈</li>
      <li>공지사항</li>
    </div>
  </ul>
);

// ⭕ React.Fragment(<>...</>)를 활용하여 실제 DOM 오염을 방지한 형태
const Breadcrumb = () => (
  <ul className="breadcrumb">
    <>
      <li>홈</li>
      <li>공지사항</li>
    </>
  </ul>
);

Applying <React.Fragment> (the shorthand syntax <>...</>) allows you to maintain the correct hierarchy without leaving unnecessary tags in the browser's actual rendering tree.

3. Key Considerations by Disability Type (Visual vs. Hearing)

To meet the standards of the web accessibility guidelines (KWCAG 2.2), the sensory environments through which users perceive and operate the web must be reflected in components.

  • People with visual impairments (blind and low-vision users): Because they cannot use a mouse, they rely solely on the keyboard (Tab, Shift + Tab, arrow keys) and the spoken output of a screen reader. All interactive elements must be keyboard-focusable, and visual information must always be converted into alternative text (alt, aria-label, IR techniques). In addition, dynamic screen changes resulting from asynchronous communication must be announced through real-time voice interruption properties.

  • People with hearing impairments (deaf and hard-of-hearing users): Synchronized captions (<track> conforming to the WebVTT specification) must be provided, containing not only dialogue from video media but also background music and sound-effect information. Furthermore, feedback provided only through sound, such as an error tone or processing-complete notification, must also be delivered simultaneously through visual text and toast popups.

4. Practical Accessibility Patterns for Four Core UI Components

4.1. Screen-Reader-Only Hidden Text Component (VisuallyHidden)

Styles such as display: none or visibility: hidden used on icon buttons remove elements from the browser's rendering tree, preventing screen readers from reading them as well. An IR (Image Replacement) component that is fully conveyed to assistive devices while being hidden visually should be standardized and used across the application.

// components/common/VisuallyHidden.jsx
import React from 'react';

const hiddenStyle = {
  position: 'absolute',
  width: '1px',
  height: '1px',
  padding: '0',
  margin: '-1px',
  overflow: 'hidden',
  clip: 'rect(0, 0, 0, 0)',
  whiteSpace: 'nowrap',
  border: '0',
};

export const VisuallyHidden = ({ children, as: Tag = 'span' }) => (
  <Tag style={hiddenStyle}>{children}</Tag>
);

// 활용 예시: 닫기 아이콘 버튼
export const CloseButton = ({ onClick }) => (
  <button type="button" onClick={onClick} className="icon-btn">
    <svg aria-hidden="true" focusable="false">{/* 아이콘 그래픽 */}</svg>
    <VisuallyHidden>팝업 레이어 닫기</VisuallyHidden>
  </button>
);

Block unnecessary SVG graphics from being read by applying aria-hidden="true", and provide assistive technology users with the precise action intent through VisuallyHidden text wrapped inside.

4.2. Accordion Component: Synchronizing State Values with WAI-ARIA

Toggle UIs with open and closed states must directly map React's useState state to WAI-ARIA attributes.

// components/ui/Accordion.jsx
import React, { useState } from 'react';

export const AccordionItem = ({ id, title, content }) => {
  const [isOpen, setIsOpen] = useState(false);
  const headerId = `acc-header-${id}`;
  const panelId = `acc-panel-${id}`;

return (
    <div className="accordion-item">
      <h3>
        <button
          type="button"
          id={headerId}
          aria-expanded={isOpen}
          aria-controls={panelId}
          onClick={() => setIsOpen((prev) => !prev)}
        >
          {title}
          <span aria-hidden="true">{isOpen ? '▲' : '▼'}</span>
        </button>
      </h3>
      <div
        id={panelId}
        role="region"
        aria-labelledby={headerId}
        hidden={!isOpen}
      >
        <p>{content}</p>
      </div>
    </div>
  );
};
  • aria-expanded={isOpen}: Bind the Boolean state value so that the screen reader automatically announces the button's current state as "expanded" or "collapsed".

  • aria-controls and aria-labelledby: Connect the trigger button and the actual content panel using explicit ID values to define their relationship.

  • hidden={!isOpen}: Apply the native hidden attribute so that, when closed, the content is safely excluded from both screen rendering and the accessibility tree.

4.3. Modal Component: Focus Trap and Restoration

Modal components are evaluated most strictly in accessibility quality audits. By combining useRef and useEffect, you must fully control keyboard focus cycling within the modal and restore focus to the previous element when the modal closes.

// components/ui/AccessibleModal.jsx
import React, { useEffect, useRef } from 'react';

export const AccessibleModal = ({ isOpen, onClose, title, children }) => {
  const modalRef = useRef(null);
  const prevFocusRef = useRef(null);

 useEffect(() => {
    if (!isOpen) return;

 // 1. 모달 활성화 전 현재 초점 요소 저장
    prevFocusRef.current = document.activeElement;

 // 2. 모달 내부 초점 가능 요소 탐색 및 첫 번째 요소로 초점 이동
    const focusable = modalRef.current?.querySelectorAll(
      'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
    );
    if (focusable?.length) focusable[0].focus();

 // 3. Tab 키 순환(Focus Trap) 및 ESC 닫기 제어
    const handleKeyDown = (e) => {
      if (e.key === 'Escape') {
        onClose();
        return;
      }
      if (e.key === 'Tab' && focusable?.length) {
        const first = focusable[0];
        const last = focusable[focusable.length - 1];

 if (e.shiftKey && document.activeElement === first) {
          e.preventDefault();
          last.focus();
        } else if (!e.shiftKey && document.activeElement === last) {
          e.preventDefault();
          first.focus();
        }
      }
    };

 window.addEventListener('keydown', handleKeyDown);

 // 4. 언마운트 또는 닫힘 시 기존 초점 복귀
    return () => {
      window.removeEventListener('keydown', handleKeyDown);
      prevFocusRef.current?.focus();
    };
  }, [isOpen, onClose]);

  if (!isOpen) return null;

  return (
    <div className="modal-backdrop" onClick={onClose}>
      <div
        ref={modalRef}
        role="dialog"
        aria-modal="true"
        aria-labelledby="modal-title"
        className="modal-box"
        onClick={(e) => e.stopPropagation()}
      >
        <h2 id="modal-title">{title}</h2>
        <div className="modal-content">{children}</div>
        <button type="button" onClick={onClose}>닫기</button>
      </div>
    </div>
  );
};

Assigning role="dialog" and aria-modal="true" allows assistive technologies to recognize the current screen as a dialog layer, while the internal focus loop prevents the critical defect of the Tab key escaping into the background.

4.4. Real-Time Dynamic Notifications (aria-live) and Synchronized Video Captions (track)

When an error message is displayed in part of the screen as a result of asynchronous SPA communication, the aria-live attribute must be applied to notify users with visual impairments in real time. In addition, video content must include WebVTT-standard captions to ensure accessibility for people with hearing impairments.

// 실시간 폼 에러 낭독 컴포넌트
export const FormAlert = ({ errorMsg }) => {
  if (!errorMsg) return null;
  return (
    <div role="alert" aria-live="assertive" className="error-box">
      <span aria-hidden="true">⚠️</span>
      <p>{errorMsg}</p>
    </div>
  );
};

// 청각장애인을 위한 WebVTT 자막 비디오 컴포넌트
export const VideoPlayer = ({ videoSrc, subtitleSrc, title }) => (
  <video controls aria-label={title}>
    <source src={videoSrc} type="video/mp4" />
    <track kind="subtitles" src={subtitleSrc} srcLang="ko" label="한국어 자막" default />
  </video>
);

aria-live="assertive" immediately interrupts the existing announcement when an error is rendered and announces the error message with the highest priority. For ordinary informational messages, use aria-live="polite", which does not disrupt the user's reading flow.

5. Essential Pre-Deployment Verification: A Three-Step Self-Check Workflow

This is a three-step verification routine that prevents defects during the work process without waiting for feedback from an auditing agency after development is complete.

  1. Keyboard-Only Navigation (Mouse-Free Test): Navigate the entire screen using only the Tab, Shift + Tab, Enter, and Space keys, without using a mouse. Check whether the focus outline is clearly visible to the naked eye and whether focus cycles normally within layer popups.

  2. Run Automated Diagnostic Tools: Run axe DevTools or Chrome Lighthouse in the browser's developer tools to mechanically verify color contrast between text and the background (minimum 4.5:1), missing image alt attributes, and whether form controls are mapped through id-htmlFor.

  3. Listen with the OS's Built-In Screen Reader: Run VoiceOver on macOS (Cmd + F5) or NVDA on Windows (free), and navigate through the components with your eyes closed. Check whether the purpose of icon buttons is clearly announced in Korean and whether the modal correctly begins by reading its title when it opens.

6. Conclusion: Accessibility Is a Publisher's Core Expertise

SI project sites are always operating under tight schedules. In such an environment, treating web accessibility as "an ancillary task where it is enough to avoid deductions just before launch" puts the entire schedule at risk due to last-minute rework.

If publishers establish a standard semantic structure from the early stage of marking up React components, connect state values with ARIA attributes, and design stable keyboard focus flows, the project's overall quality and development productivity will improve significantly.

sangsuni

Site footer