Components - popover

comment

  • 타입: ui-popover--complex (복잡한 구조, ex. 알림), ui-popover--tooltip (간단한 툴팁, ex. 정보 설명)
  • 토글 버튼: js-popover-toggle 클래스 필수, aria-label, aria-haspopup="true", aria-expanded 속성 필수
  • 팝오버 패널: ui-popover__panel 클래스 사용, 초기 상태는 hidden 속성으로 숨김 처리
  • 연결: 복잡한 구조의 경우 aria-controls로 패널 ID를 참조하고, 패널에 해당 id 속성 추가
  • 토글 기능: js-popover-toggle 버튼 클릭 시 팝오버 열기/닫기, aria-expanded 속성 자동 관리
  • 키보드 제어: ESC 키로 팝오버 닫기, Tab 키로 포커스 트랩 (팝오버 내부에서만 포커스 이동)
  • 외부 클릭 처리: 팝오버 외부 클릭 시 자동으로 닫힘
  • 자동 포커스: 팝오버 열릴 때 첫 번째 포커스 가능한 요소에 자동 포커스, 닫힐 때 토글 버튼으로 포커스 복귀
  • 다중 팝오버: 새 팝오버가 열릴 때 다른 열린 팝오버들은 자동으로 닫힘
  • JavaScript 초기화: initPopovers() 함수가 자동으로 실행되며, 모든 .ui-popover 요소 초기화
popover - complex
HTML 구조
<div class="ui-popover ui-popover--complex">
  <button
    type="button"
    class="app-utils__item app-utils__item--notify has-value js-popover-toggle"
    aria-label="알림"
    aria-haspopup="true"
    aria-expanded="false"
    aria-controls="popover-notify"
  ></button>

  <div class="ui-popover__panel" id="popover-notify">
    <div class="ui-popover__header">
      <span class="ui-popover__bundle">
        <span class="ui-popover__title">알림</span>
        <span class="ui-popover__count">(67)</span>
      </span>

      <button
        type="button"
        class="ui-icon-button ui-icon-button--settings"
        aria-label="수신 설정"
        data-tooltip="수신 설정"
      ></button>
    </div>

    <div class="ui-popover__content ui-popover__content--scroll">
      <ul class="utils-notify">
        <li class="utils-notify__item">
          <a href="#" class="utils-notify__card">
            <p class="utils-notify__message">
              [광고 검수대기] 20251021_인스트림 풀배너_광고가 검수대기 중입니다.
            </p>
            <time class="utils-notify__time">11-10 12:45</time>
          </a>
        </li>
        <!-- ... 기타 알림 항목들 ... -->
      </ul>
    </div>
    <div class="ui-popover__footer">
      <button type="button" class="ui-button ui-button--small ui-button--secondary">이력보기</button>
      <button type="button" class="ui-button ui-button--small ui-button--secondary">모두읽음</button>
    </div>
  </div>
</div>
popover - tooltip
HTML 구조
<div class="ui-popover ui-popover--tooltip">
  <button
    type="button"
    class="ui-popover__button-info js-popover-toggle"
    aria-label="요약 보고서 설명"
    aria-haspopup="true"
    aria-expanded="true"
  ></button>

  <div class="ui-popover__panel" hidden>
    <div class="ui-popover__content">
      <div class="ui-popover__tooltip-text">요약 보고서에서는 직접광고 지표만 보여집니다.</div>
    </div>
  </div>
</div>