탐색

v2.1.0
오버레이

코치마크

컨트롤을 가리키며 그 기능을 설명하는 안내 투어의 한 단계입니다.

이 페이지의 내용

코치마크는 안내 투어의 한 단계입니다. 잉크색의 작은 카드가 컨트롤을 가리키며 그 기능을 설명합니다. 코치마크는 팝오버이므로 브라우저가 최상위 레이어에 표시하고 포커스를 카드 안으로 옮깁니다. CSS 앵커 위치 지정은 코치마크를 연 요소에 맞춰 카드를 배치하고 화살표가 해당 요소를 가리키게 합니다. 비컨은 간헐적으로 고리 효과를 내는 잉크색 점으로, 페이지에서 안내할 위치를 표시하며 코치마크를 여는 버튼 역할을 합니다. 투어는 tour 동작으로 여러 코치마크를 차례로 엽니다.

코치마크

<div class="toolbar" role="toolbar" aria-label="Deployments">  <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Search">    <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">      <circle cx="7" cy="7" r="4.5" /><path d="M10.182 10.182L14 14" />    </svg>  </button>  <span class="relative inline-flex">    <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Filter">      <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">        <path d="M4.5365 3L11.4635 3A1 1 0 0 1 12.2548 4.6114L9.4587 8.2299A1 1 0 0 0 9.25 8.8413L9.25 11.323A1 1 0 0 1 8.6214 12.2514L7.875 12.55A0.8203 0.8203 0 0 1 6.75 11.7883L6.75 8.8413A1 1 0 0 0 6.5413 8.2299L3.7452 4.6114A1 1 0 0 1 4.5365 3Z" />      </svg>    </button>    <button type="button" class="coachmark-beacon absolute top(-3) right(-3)" popovertarget="tip-filter" aria-label="What is new in Filter"></button>    <div id="tip-filter" popover class="coachmark coachmark-top" role="dialog" aria-labelledby="tip-filter-title">      <p class="coachmark-count">New</p>      <h2 class="coachmark-title" id="tip-filter-title">Filter by author</h2>      <p class="coachmark-text">        Narrow the deployments to the ones you shipped, or to anyone on the team.      </p>      <div class="coachmark-actions">        <button type="button" class="btn btn-sm" popovertarget="tip-filter" popovertargetaction="hide" autofocus>          Got it        </button>      </div>    </div>  </span>  <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Share">    <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">      <circle cx="3.6667" cy="8" r="1.6667" /><circle cx="12" cy="3.3333" r="1.6667" /><circle cx="12" cy="12.6667" r="1.6667" /><path d="M5.12 7.1867L10.5467 4.1467" /><path d="M5.12 8.8133L10.5467 11.8533" />    </svg>  </button></div>
import SearchIcon from '@master/icons-react/native/16/soft/search'import FilterIcon from '@master/icons-react/native/16/soft/filter'import ShareIcon from '@master/icons-react/native/16/soft/share'<div className="toolbar" role="toolbar" aria-label="Deployments">  <button type="button" className="btn btn-quiet btn-sm btn-square" aria-label="Search">    <SearchIcon className="icon" />  </button>  <span className="relative inline-flex">    <button type="button" className="btn btn-quiet btn-sm btn-square" aria-label="Filter">      <FilterIcon className="icon" />    </button>    <button type="button" className="coachmark-beacon absolute top(-3) right(-3)" popoverTarget="tip-filter" aria-label="What is new in Filter"></button>    <div id="tip-filter" popover="" className="coachmark coachmark-top" role="dialog" aria-labelledby="tip-filter-title">      <p className="coachmark-count">New</p>      <h2 className="coachmark-title" id="tip-filter-title">Filter by author</h2>      <p className="coachmark-text">        Narrow the deployments to the ones you shipped, or to anyone on the team.      </p>      <div className="coachmark-actions">        <button type="button" className="btn btn-sm" popoverTarget="tip-filter" popoverTargetAction="hide" autoFocus>          Got it        </button>      </div>    </div>  </span>  <button type="button" className="btn btn-quiet btn-sm btn-square" aria-label="Share">    <ShareIcon className="icon" />  </button></div>
<script>  import SearchIcon from '@master/icons-svelte/native/16/soft/search'  import FilterIcon from '@master/icons-svelte/native/16/soft/filter'  import ShareIcon from '@master/icons-svelte/native/16/soft/share'</script><div class="toolbar" role="toolbar" aria-label="Deployments">  <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Search">    <SearchIcon class="icon" />  </button>  <span class="relative inline-flex">    <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Filter">      <FilterIcon class="icon" />    </button>    <button type="button" class="coachmark-beacon absolute top(-3) right(-3)" popovertarget="tip-filter" aria-label="What is new in Filter"></button>    <div id="tip-filter" popover class="coachmark coachmark-top" role="dialog" aria-labelledby="tip-filter-title">      <p class="coachmark-count">New</p>      <h2 class="coachmark-title" id="tip-filter-title">Filter by author</h2>      <p class="coachmark-text">        Narrow the deployments to the ones you shipped, or to anyone on the team.      </p>      <div class="coachmark-actions">        <button type="button" class="btn btn-sm" popovertarget="tip-filter" popovertargetaction="hide" autofocus>          Got it        </button>      </div>    </div>  </span>  <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Share">    <ShareIcon class="icon" />  </button></div>
<script setup>import SearchIcon from '@master/icons-vue/native/16/soft/search'import FilterIcon from '@master/icons-vue/native/16/soft/filter'import ShareIcon from '@master/icons-vue/native/16/soft/share'</script><template>  <div class="toolbar" role="toolbar" aria-label="Deployments">    <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Search">      <SearchIcon class="icon" />    </button>    <span class="relative inline-flex">      <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Filter">        <FilterIcon class="icon" />      </button>      <button type="button" class="coachmark-beacon absolute top(-3) right(-3)" popovertarget="tip-filter" aria-label="What is new in Filter"></button>      <div id="tip-filter" popover class="coachmark coachmark-top" role="dialog" aria-labelledby="tip-filter-title">        <p class="coachmark-count">New</p>        <h2 class="coachmark-title" id="tip-filter-title">Filter by author</h2>        <p class="coachmark-text">          Narrow the deployments to the ones you shipped, or to anyone on the team.        </p>        <div class="coachmark-actions">          <button type="button" class="btn btn-sm" popovertarget="tip-filter" popovertargetaction="hide" autofocus>            Got it          </button>        </div>      </div>    </span>    <button type="button" class="btn btn-quiet btn-sm btn-square" aria-label="Share">      <ShareIcon class="icon" />    </button>  </div></template>
필터 버튼에 있는 점을 누르세요.

카드에는 sheet-inverse의 평평한 반전 표면을 적용합니다. moonstone 배경에는 잉크색을, obsidian 배경에는 진주색을 전경색으로 사용합니다. 이 표면은 일반 팝오버의 표면과 뒤쪽 페이지에서 뚜렷하게 구분되며, 화살표는 카드에 이음새 없이 이어집니다. 카드의 기본 button은 실행할 동작을 강조합니다. 강조를 낮춘 버튼에는 카드의 잉크색을 쓰고, 호버 시에는 같은 색을 배경에 옅게 적용합니다.

#구성

제목만 필수입니다.

클래스내용
coachmark-count‘4단계 중 2단계’와 같은 투어 진행 위치나 ‘새 기능’과 같은 짧은 문구를 한층 은은한 잉크색으로 표시
coachmark-title단계 제목. 제목에 id를 지정하고 이를 참조해 코치마크에 접근성 이름을 부여하세요.
coachmark-text컨트롤의 기능을 설명하는 한두 문장
coachmark-actions카드 하단에 배치하는 작은 버튼. 버튼이 여러 개면 ‘건너뛰기’와 같은 첫 버튼은 시작 쪽에 두고, ‘이전’, ‘다음’과 같은 나머지 버튼은 끝 쪽에 정렬합니다.

동작 버튼은 카드 가장자리에서 12px 안쪽에 배치합니다. 작은 버튼의 둥근 모서리가 카드 모서리 안에 맞물리도록 카드의 모서리 반경은 버튼의 모서리 반경에 이 여백을 더한 값으로 설정합니다.

#배치

코치마크는 기본적으로 자신을 연 요소의 아래쪽 중앙에 열리며, 화살표 끝은 그 요소에서 6px 떨어집니다. 아래쪽 공간이 부족하면 위쪽으로 전환됩니다. coachmark-top은 위쪽 공간을 우선 사용합니다. 화면 하단에 가까운 컨트롤이나 컨트롤의 위쪽 모서리에 놓인 비컨에 사용합니다. 첫 번째 예시에서는 비컨을 위쪽 모서리에 배치합니다.

화살표는 마크업에서 코치마크 바로 앞의 요소를 가리킵니다. 따라서 코치마크는 비컨이나 설명할 컨트롤 바로 뒤에 배치하세요. 투어에서는 단계의 대상 위에 놓이는 투어의 스포트라이트를 가리킵니다. 코치마크가 열려 있는 동안 화살표가 가리키는 요소가 앵커로 지정되고 화살표는 그 요소의 중앙을 따라갑니다. 뷰포트 가장자리 때문에 카드가 옆으로 밀려도 화살표는 앵커 중앙을 계속 가리키면서 카드의 둥근 모서리를 피합니다. 카드가 위아래로 전환되면 화살표도 카드의 반대쪽 가장자리로 이동합니다. 투어에서처럼 코치마크는 한 번에 하나만 열립니다.

#비컨

coachmark-beacon은 버튼에 표시되는 10px 점입니다. 점 둘레에는 배경 표면과 같은 색의 테두리가 있으며, 조작 영역은 24px이고 터치 화면에서는 44px입니다. 비컨은 popovertarget 속성으로 코치마크를 열며, 무엇을 여는지 알려 주는 aria-label 속성이 필요합니다. 비컨의 위치는 페이지에서 정합니다. relative 래퍼 안에서 absolute 유틸리티를 사용해 비컨을 컨트롤의 위쪽 모서리에 놓거나 컨트롤 옆에 같은 행으로 배치하세요.

비컨의 고리는 사용자의 시선을 끕니다. 비컨에 호버하거나 포커스가 있을 때, 코치마크가 열려 있을 때, 또는 동작 줄이기 설정이 켜져 있을 때는 고리가 움직이지 않고 점 둘레에 머뭅니다. 사용자가 해당 단계를 본 뒤에는 비컨을 제거하세요.

#안내 투어

투어는 여러 코치마크를 차례로 열며, 각 코치마크는 자신이 설명하는 컨트롤을 기준으로 열립니다. 투어의 단계는 진행 순서대로 coachmark-tour 안에 두고, 각 단계에 popover="manual"을 지정하세요. 그러면 사용자가 안내 중인 컨트롤을 시험해 보는 등 페이지를 클릭해도 투어가 종료되지 않습니다. 단계는 data-target에 선택자를 지정해 대상을 정합니다. 지정하지 않으면 마크업에서 단계 바로 앞의 요소를 가리킵니다. 단계의 버튼은 value로 기능을 나타냅니다. next, back, skip을 사용하고, 마지막 단계에는 done을 사용합니다.

나머지는 tour 동작이 처리합니다. command="--start"가 있고 commandfor로 투어를 가리키는 버튼을 누르면 투어가 시작됩니다. 동작은 showPopover({ source })로 각 단계를 대상 기준으로 엽니다. 따라서 브라우저가 카드를 대상에 앵커로 연결하고 CSS가 배치하며, 포커스는 카드 안의 ‘다음’ 또는 ‘완료’ 버튼으로 이동합니다. 투어 안에 coachmark-spotlight가 있으면 먼저 대상 위에 엽니다. 단계가 마크업 어디에 있든 단계의 화살표는 스포트라이트를 가리킵니다.

안내 투어

<div class="coachmark-tour flex items-center gap-sm" id="deploys-tour">  <button type="button" class="btn btn-sm" commandfor="deploys-tour" command="--start">    Take the tour  </button>  <div class="toolbar" role="toolbar" aria-label="Deployments">    <button type="button" class="btn btn-quiet btn-sm btn-square" id="deploys-search" aria-label="Search">      <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">        <circle cx="7" cy="7" r="4.5" /><path d="M10.182 10.182L14 14" />      </svg>    </button>    <button type="button" class="btn btn-quiet btn-sm btn-square" id="deploys-filter" aria-label="Filter">      <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">        <path d="M4.5365 3L11.4635 3A1 1 0 0 1 12.2548 4.6114L9.4587 8.2299A1 1 0 0 0 9.25 8.8413L9.25 11.323A1 1 0 0 1 8.6214 12.2514L7.875 12.55A0.8203 0.8203 0 0 1 6.75 11.7883L6.75 8.8413A1 1 0 0 0 6.5413 8.2299L3.7452 4.6114A1 1 0 0 1 4.5365 3Z" />      </svg>    </button>    <button type="button" class="btn btn-quiet btn-sm btn-square" id="deploys-share" aria-label="Share">      <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">        <circle cx="3.6667" cy="8" r="1.6667" /><circle cx="12" cy="3.3333" r="1.6667" /><circle cx="12" cy="12.6667" r="1.6667" /><path d="M5.12 7.1867L10.5467 4.1467" /><path d="M5.12 8.8133L10.5467 11.8533" />      </svg>    </button>  </div>  <div class="coachmark-spotlight" popover="manual"></div>  <div class="coachmark" popover="manual" role="dialog" aria-labelledby="deploys-search-title" data-target="#deploys-search">    <p class="coachmark-count">1 of 3</p>    <h2 class="coachmark-title" id="deploys-search-title">Search every deployment</h2>    <p class="coachmark-text">Find one by its branch, its commit or the person who shipped it.</p>    <div class="coachmark-actions">      <button type="button" class="btn btn-sm btn-quiet" value="skip">Skip</button>      <button type="button" class="btn btn-sm" value="next">Next</button>    </div>  </div>  <div class="coachmark" popover="manual" role="dialog" aria-labelledby="deploys-filter-title" data-target="#deploys-filter">    <p class="coachmark-count">2 of 3</p>    <h2 class="coachmark-title" id="deploys-filter-title">Filter the list</h2>    <p class="coachmark-text">Keep only the deployments of one branch, one author or one status.</p>    <div class="coachmark-actions">      <button type="button" class="btn btn-sm btn-quiet" value="skip">Skip</button>      <button type="button" class="btn btn-sm btn-quiet" value="back">Back</button>      <button type="button" class="btn btn-sm" value="next">Next</button>    </div>  </div>  <div class="coachmark" popover="manual" role="dialog" aria-labelledby="deploys-share-title" data-target="#deploys-share">    <p class="coachmark-count">3 of 3</p>    <h2 class="coachmark-title" id="deploys-share-title">Share a deployment</h2>    <p class="coachmark-text">Copy a link to it, open for anyone on the team.</p>    <div class="coachmark-actions">      <button type="button" class="btn btn-sm btn-quiet" value="back">Back</button>      <button type="button" class="btn btn-sm" value="done">Done</button>    </div>  </div></div><script type="module">  import { attach } from '@master/ui/behaviors'  attach()</script>
import { useEffect, useRef } from 'react'import { attach } from '@master/ui/behaviors'import SearchIcon from '@master/icons-react/native/16/soft/search'import FilterIcon from '@master/icons-react/native/16/soft/filter'import ShareIcon from '@master/icons-react/native/16/soft/share'export function Example() {  const root = useRef<HTMLDivElement>(null)  useEffect(() => attach(root.current!), [])  return (    <div ref={root} className="coachmark-tour flex items-center gap-sm" id="deploys-tour">      <button type="button" className="btn btn-sm" {...{ commandfor: 'deploys-tour', command: '--start' }}>        Take the tour      </button>      <div className="toolbar" role="toolbar" aria-label="Deployments">        <button type="button" className="btn btn-quiet btn-sm btn-square" id="deploys-search" aria-label="Search">          <SearchIcon className="icon" />        </button>        <button type="button" className="btn btn-quiet btn-sm btn-square" id="deploys-filter" aria-label="Filter">          <FilterIcon className="icon" />        </button>        <button type="button" className="btn btn-quiet btn-sm btn-square" id="deploys-share" aria-label="Share">          <ShareIcon className="icon" />        </button>      </div>      <div className="coachmark-spotlight" popover="manual"></div>      <div className="coachmark" popover="manual" role="dialog" aria-labelledby="deploys-search-title" data-target="#deploys-search">        <p className="coachmark-count">1 of 3</p>        <h2 className="coachmark-title" id="deploys-search-title">Search every deployment</h2>        <p className="coachmark-text">          Find one by its branch, its commit or the person who shipped it.        </p>        <div className="coachmark-actions">          <button type="button" className="btn btn-sm btn-quiet" value="skip">Skip</button>          <button type="button" className="btn btn-sm" value="next">Next</button>        </div>      </div>      <div className="coachmark" popover="manual" role="dialog" aria-labelledby="deploys-filter-title" data-target="#deploys-filter">        <p className="coachmark-count">2 of 3</p>        <h2 className="coachmark-title" id="deploys-filter-title">Filter the list</h2>        <p className="coachmark-text">          Keep only the deployments of one branch, one author or one status.        </p>        <div className="coachmark-actions">          <button type="button" className="btn btn-sm btn-quiet" value="skip">Skip</button>          <button type="button" className="btn btn-sm btn-quiet" value="back">Back</button>          <button type="button" className="btn btn-sm" value="next">Next</button>        </div>      </div>      <div className="coachmark" popover="manual" role="dialog" aria-labelledby="deploys-share-title" data-target="#deploys-share">        <p className="coachmark-count">3 of 3</p>        <h2 className="coachmark-title" id="deploys-share-title">Share a deployment</h2>        <p className="coachmark-text">Copy a link to it, open for anyone on the team.</p>        <div className="coachmark-actions">          <button type="button" className="btn btn-sm btn-quiet" value="back">Back</button>          <button type="button" className="btn btn-sm" value="done">Done</button>        </div>      </div>    </div>  )}
<script>  import { attach } from '@master/ui/behaviors'  import SearchIcon from '@master/icons-svelte/native/16/soft/search'  import FilterIcon from '@master/icons-svelte/native/16/soft/filter'  import ShareIcon from '@master/icons-svelte/native/16/soft/share'</script><div class="coachmark-tour flex items-center gap-sm" id="deploys-tour" {@attach attach}>  <button type="button" class="btn btn-sm" commandfor="deploys-tour" command="--start">    Take the tour  </button>  <div class="toolbar" role="toolbar" aria-label="Deployments">    <button type="button" class="btn btn-quiet btn-sm btn-square" id="deploys-search" aria-label="Search">      <SearchIcon class="icon" />    </button>    <button type="button" class="btn btn-quiet btn-sm btn-square" id="deploys-filter" aria-label="Filter">      <FilterIcon class="icon" />    </button>    <button type="button" class="btn btn-quiet btn-sm btn-square" id="deploys-share" aria-label="Share">      <ShareIcon class="icon" />    </button>  </div>  <div class="coachmark-spotlight" popover="manual"></div>  <div class="coachmark" popover="manual" role="dialog" aria-labelledby="deploys-search-title" data-target="#deploys-search">    <p class="coachmark-count">1 of 3</p>    <h2 class="coachmark-title" id="deploys-search-title">Search every deployment</h2>    <p class="coachmark-text">Find one by its branch, its commit or the person who shipped it.</p>    <div class="coachmark-actions">      <button type="button" class="btn btn-sm btn-quiet" value="skip">Skip</button>      <button type="button" class="btn btn-sm" value="next">Next</button>    </div>  </div>  <div class="coachmark" popover="manual" role="dialog" aria-labelledby="deploys-filter-title" data-target="#deploys-filter">    <p class="coachmark-count">2 of 3</p>    <h2 class="coachmark-title" id="deploys-filter-title">Filter the list</h2>    <p class="coachmark-text">Keep only the deployments of one branch, one author or one status.</p>    <div class="coachmark-actions">      <button type="button" class="btn btn-sm btn-quiet" value="skip">Skip</button>      <button type="button" class="btn btn-sm btn-quiet" value="back">Back</button>      <button type="button" class="btn btn-sm" value="next">Next</button>    </div>  </div>  <div class="coachmark" popover="manual" role="dialog" aria-labelledby="deploys-share-title" data-target="#deploys-share">    <p class="coachmark-count">3 of 3</p>    <h2 class="coachmark-title" id="deploys-share-title">Share a deployment</h2>    <p class="coachmark-text">Copy a link to it, open for anyone on the team.</p>    <div class="coachmark-actions">      <button type="button" class="btn btn-sm btn-quiet" value="back">Back</button>      <button type="button" class="btn btn-sm" value="done">Done</button>    </div>  </div></div>
<script setup>import { onMounted, onUnmounted, ref } from 'vue'import { attach } from '@master/ui/behaviors'import SearchIcon from '@master/icons-vue/native/16/soft/search'import FilterIcon from '@master/icons-vue/native/16/soft/filter'import ShareIcon from '@master/icons-vue/native/16/soft/share'const root = ref(null)let detachonMounted(() => { detach = attach(root.value) })onUnmounted(() => detach?.())</script><template>  <div ref="root" class="coachmark-tour flex items-center gap-sm" id="deploys-tour">    <button type="button" class="btn btn-sm" commandfor="deploys-tour" command="--start">      Take the tour    </button>    <div class="toolbar" role="toolbar" aria-label="Deployments">      <button type="button" class="btn btn-quiet btn-sm btn-square" id="deploys-search" aria-label="Search">        <SearchIcon class="icon" />      </button>      <button type="button" class="btn btn-quiet btn-sm btn-square" id="deploys-filter" aria-label="Filter">        <FilterIcon class="icon" />      </button>      <button type="button" class="btn btn-quiet btn-sm btn-square" id="deploys-share" aria-label="Share">        <ShareIcon class="icon" />      </button>    </div>    <div class="coachmark-spotlight" popover="manual"></div>    <div class="coachmark" popover="manual" role="dialog" aria-labelledby="deploys-search-title" data-target="#deploys-search">      <p class="coachmark-count">1 of 3</p>      <h2 class="coachmark-title" id="deploys-search-title">Search every deployment</h2>      <p class="coachmark-text">Find one by its branch, its commit or the person who shipped it.</p>      <div class="coachmark-actions">        <button type="button" class="btn btn-sm btn-quiet" value="skip">Skip</button>        <button type="button" class="btn btn-sm" value="next">Next</button>      </div>    </div>    <div class="coachmark" popover="manual" role="dialog" aria-labelledby="deploys-filter-title" data-target="#deploys-filter">      <p class="coachmark-count">2 of 3</p>      <h2 class="coachmark-title" id="deploys-filter-title">Filter the list</h2>      <p class="coachmark-text">        Keep only the deployments of one branch, one author or one status.      </p>      <div class="coachmark-actions">        <button type="button" class="btn btn-sm btn-quiet" value="skip">Skip</button>        <button type="button" class="btn btn-sm btn-quiet" value="back">Back</button>        <button type="button" class="btn btn-sm" value="next">Next</button>      </div>    </div>    <div class="coachmark" popover="manual" role="dialog" aria-labelledby="deploys-share-title" data-target="#deploys-share">      <p class="coachmark-count">3 of 3</p>      <h2 class="coachmark-title" id="deploys-share-title">Share a deployment</h2>      <p class="coachmark-text">Copy a link to it, open for anyone on the team.</p>      <div class="coachmark-actions">        <button type="button" class="btn btn-sm btn-quiet" value="back">Back</button>        <button type="button" class="btn btn-sm" value="done">Done</button>      </div>    </div>  </div></template>
투어를 시작한 뒤 Next, Back, Esc를 눌러 보세요.

투어는 이 예시처럼 설명하는 영역을 포함할 수도 있고, 단계와 스포트라이트만 담을 수도 있습니다. 단계는 문서 어디에 있든 대상을 찾습니다. 닫혀 있는 단계와 스포트라이트는 공간을 차지하지 않으므로, 투어 요소를 그대로 해당 행으로 사용할 수 있습니다.

비컨으로 여는 단일 코치마크에는 이런 처리가 필요 없습니다. 이 코치마크는 popover="auto"이므로 바깥을 클릭하거나 Esc를 누르면 브라우저가 코치마크를 닫고 비컨으로 포커스를 돌려보냅니다. 별도 스크립트 없이 동작합니다.

#기다리는 단계

단계는 사용자의 조작이나 대상이 나타나기를 기다릴 수 있습니다.

  • 사용자 조작. data-advance가 있는 단계는 대상에서 발생하면 투어를 진행시키는 click 같은 이벤트를 지정합니다. 이런 단계에는 ‘다음’ 버튼을 두지 마세요. 사용자에게 직접 해 보도록 요청하고, 페이지가 반응하면 투어가 계속됩니다. ‘건너뛰기’와 Esc로는 여전히 나갈 수 있습니다.
  • 나중에 나타나는 대상. 단계의 대상이 페이지에 없거나 렌더링되지 않았다면 단계는 대상을 기다리다가 나타나는 즉시 열립니다. 버튼을 눌러야 나타나는 필드나 아직 로딩 중인 행이 그 예입니다. 3초 또는 동작에 지정한 wait 시간이 지나도 대상이 나타나지 않으면 해당 단계를 건너뛰며, 마지막 단계를 지나면 투어가 완료됩니다. 투어는 아무것도 가리키지 않는 카드에서 멈추지 않습니다. 표시되지 못할 수도 있는 단계에는 그 단계 없이도 찾을 수 있는 내용만 담으세요.

기다리는 단계

<div class="coachmark-tour flex flex-col items-center gap-md" id="projects-tour">  <div class="flex items-center gap-sm">    <button type="button" class="btn btn-sm" commandfor="projects-tour" command="--start">      Take the tour    </button>    <button type="button" class="btn btn-sm btn-primary" id="projects-new">New project</button>  </div>  <input class="input w(240)" id="projects-name" placeholder="Project name" aria-label="Project name" hidden>  <div class="coachmark-spotlight" popover="manual"></div>  <div class="coachmark" popover="manual" role="dialog" aria-labelledby="projects-new-title" data-target="#projects-new" data-advance="click">    <p class="coachmark-count">1 of 2</p>    <h2 class="coachmark-title" id="projects-new-title">Start a project</h2>    <p class="coachmark-text">Press New project. The tour goes on once its form is open.</p>    <div class="coachmark-actions">      <button type="button" class="btn btn-sm btn-quiet" value="skip">Skip</button>    </div>  </div>  <div class="coachmark" popover="manual" role="dialog" aria-labelledby="projects-name-title" data-target="#projects-name">    <p class="coachmark-count">2 of 2</p>    <h2 class="coachmark-title" id="projects-name-title">Name it</h2>    <p class="coachmark-text">      Use the name your team already calls it by. You can change it later.    </p>    <div class="coachmark-actions">      <button type="button" class="btn btn-sm btn-quiet" value="back">Back</button>      <button type="button" class="btn btn-sm" value="done">Done</button>    </div>  </div></div><script>document.getElementById('projects-new').addEventListener('click', function () {  setTimeout(function () { document.getElementById('projects-name').hidden = false }, 400)})</script><script type="module">  import { attach } from '@master/ui/behaviors'  attach()</script>
투어를 시작한 뒤 New project를 눌러 보세요. 다음 단계는 필드가 나타날 때까지 기다립니다.

#스포트라이트

coachmark-spotlight-dim은 대화 상자의 배경막으로 단계의 대상 주변 페이지를 어둡게 하고, 대상과 그 둘레의 4px 여백은 밝게 남깁니다. 밝은 영역의 모서리는 컨트롤의 모서리 반경에 이 여백을 더한 값입니다. 배경막은 화면만큼 넓은 그림자 고리이며, 앵커 위치 지정으로 대상 위에 놓인 스포트라이트가 그립니다. 따라서 페이지를 스크롤해도 대상을 따라갑니다. 투어가 시작되면 서서히 나타나고 끝나면 서서히 사라지며, 단계를 넘길 때는 밝은 영역이 바로 이동합니다.

배경막은 벽이 아니라 칠일 뿐입니다. 그 아래의 페이지는 여전히 포인터와 키보드에 반응하므로, 사용자는 단계가 가리키는 기능을 시험해 볼 수 있고 투어는 사용자의 다른 작업을 방해하지 않습니다. 시선을 이끌어야 하는 화면의 첫 투어에 사용하고, 새 컨트롤 하나에 대한 팁에는 사용하지 마세요.

스포트라이트

<div class="coachmark-tour flex flex-col items-center gap-md" id="release-tour">  <button type="button" class="btn btn-sm" commandfor="release-tour" command="--start">    Take the tour  </button>  <div class="card flex-row items-center gap-md p-md w(300)">    <div class="flex flex-col grow(1)">      <span class="text-sm fg-text-strong">atlas.dev</span>      <span class="text-xs fg-text-muted" id="release-status">Ready, 2 minutes ago</span>    </div>    <button type="button" class="btn btn-sm btn-primary" id="release-deploy">Deploy</button>  </div>  <div class="coachmark-spotlight coachmark-spotlight-dim" popover="manual"></div>  <div class="coachmark" popover="manual" role="dialog" aria-labelledby="release-status-title" data-target="#release-status">    <p class="coachmark-count">1 of 2</p>    <h2 class="coachmark-title" id="release-status-title">See where it stands</h2>    <p class="coachmark-text">Each project says whether its last build is ready and when it ran.</p>    <div class="coachmark-actions">      <button type="button" class="btn btn-sm btn-quiet" value="skip">Skip</button>      <button type="button" class="btn btn-sm" value="next">Next</button>    </div>  </div>  <div class="coachmark" popover="manual" role="dialog" aria-labelledby="release-deploy-title" data-target="#release-deploy">    <p class="coachmark-count">2 of 2</p>    <h2 class="coachmark-title" id="release-deploy-title">Ship it</h2>    <p class="coachmark-text">Deploy sends the ready build to production.</p>    <div class="coachmark-actions">      <button type="button" class="btn btn-sm btn-quiet" value="back">Back</button>      <button type="button" class="btn btn-sm" value="done">Done</button>    </div>  </div></div><script type="module">  import { attach } from '@master/ui/behaviors'  attach()</script>
import { useEffect, useRef } from 'react'import { attach } from '@master/ui/behaviors'export function Example() {  const root = useRef<HTMLDivElement>(null)  useEffect(() => attach(root.current!), [])  return (    <div ref={root} className="coachmark-tour flex flex-col items-center gap-md" id="release-tour">      <button type="button" className="btn btn-sm" {...{ commandfor: 'release-tour', command: '--start' }}>        Take the tour      </button>      <div className="card flex-row items-center gap-md p-md w(300)">        <div className="flex flex-col grow(1)">          <span className="text-sm fg-text-strong">atlas.dev</span>          <span className="text-xs fg-text-muted" id="release-status">Ready, 2 minutes ago</span>        </div>        <button type="button" className="btn btn-sm btn-primary" id="release-deploy">Deploy</button>      </div>      <div className="coachmark-spotlight coachmark-spotlight-dim" popover="manual"></div>      <div className="coachmark" popover="manual" role="dialog" aria-labelledby="release-status-title" data-target="#release-status">        <p className="coachmark-count">1 of 2</p>        <h2 className="coachmark-title" id="release-status-title">See where it stands</h2>        <p className="coachmark-text">          Each project says whether its last build is ready and when it ran.        </p>        <div className="coachmark-actions">          <button type="button" className="btn btn-sm btn-quiet" value="skip">Skip</button>          <button type="button" className="btn btn-sm" value="next">Next</button>        </div>      </div>      <div className="coachmark" popover="manual" role="dialog" aria-labelledby="release-deploy-title" data-target="#release-deploy">        <p className="coachmark-count">2 of 2</p>        <h2 className="coachmark-title" id="release-deploy-title">Ship it</h2>        <p className="coachmark-text">Deploy sends the ready build to production.</p>        <div className="coachmark-actions">          <button type="button" className="btn btn-sm btn-quiet" value="back">Back</button>          <button type="button" className="btn btn-sm" value="done">Done</button>        </div>      </div>    </div>  )}
<script>  import { attach } from '@master/ui/behaviors'</script><div class="coachmark-tour flex flex-col items-center gap-md" id="release-tour" {@attach attach}>  <button type="button" class="btn btn-sm" commandfor="release-tour" command="--start">    Take the tour  </button>  <div class="card flex-row items-center gap-md p-md w(300)">    <div class="flex flex-col grow(1)">      <span class="text-sm fg-text-strong">atlas.dev</span>      <span class="text-xs fg-text-muted" id="release-status">Ready, 2 minutes ago</span>    </div>    <button type="button" class="btn btn-sm btn-primary" id="release-deploy">Deploy</button>  </div>  <div class="coachmark-spotlight coachmark-spotlight-dim" popover="manual"></div>  <div class="coachmark" popover="manual" role="dialog" aria-labelledby="release-status-title" data-target="#release-status">    <p class="coachmark-count">1 of 2</p>    <h2 class="coachmark-title" id="release-status-title">See where it stands</h2>    <p class="coachmark-text">Each project says whether its last build is ready and when it ran.</p>    <div class="coachmark-actions">      <button type="button" class="btn btn-sm btn-quiet" value="skip">Skip</button>      <button type="button" class="btn btn-sm" value="next">Next</button>    </div>  </div>  <div class="coachmark" popover="manual" role="dialog" aria-labelledby="release-deploy-title" data-target="#release-deploy">    <p class="coachmark-count">2 of 2</p>    <h2 class="coachmark-title" id="release-deploy-title">Ship it</h2>    <p class="coachmark-text">Deploy sends the ready build to production.</p>    <div class="coachmark-actions">      <button type="button" class="btn btn-sm btn-quiet" value="back">Back</button>      <button type="button" class="btn btn-sm" value="done">Done</button>    </div>  </div></div>
<script setup>import { onMounted, onUnmounted, ref } from 'vue'import { attach } from '@master/ui/behaviors'const root = ref(null)let detachonMounted(() => { detach = attach(root.value) })onUnmounted(() => detach?.())</script><template>  <div ref="root" class="coachmark-tour flex flex-col items-center gap-md" id="release-tour">    <button type="button" class="btn btn-sm" commandfor="release-tour" command="--start">      Take the tour    </button>    <div class="card flex-row items-center gap-md p-md w(300)">      <div class="flex flex-col grow(1)">        <span class="text-sm fg-text-strong">atlas.dev</span>        <span class="text-xs fg-text-muted" id="release-status">Ready, 2 minutes ago</span>      </div>      <button type="button" class="btn btn-sm btn-primary" id="release-deploy">Deploy</button>    </div>    <div class="coachmark-spotlight coachmark-spotlight-dim" popover="manual"></div>    <div class="coachmark" popover="manual" role="dialog" aria-labelledby="release-status-title" data-target="#release-status">      <p class="coachmark-count">1 of 2</p>      <h2 class="coachmark-title" id="release-status-title">See where it stands</h2>      <p class="coachmark-text">        Each project says whether its last build is ready and when it ran.      </p>      <div class="coachmark-actions">        <button type="button" class="btn btn-sm btn-quiet" value="skip">Skip</button>        <button type="button" class="btn btn-sm" value="next">Next</button>      </div>    </div>    <div class="coachmark" popover="manual" role="dialog" aria-labelledby="release-deploy-title" data-target="#release-deploy">      <p class="coachmark-count">2 of 2</p>      <h2 class="coachmark-title" id="release-deploy-title">Ship it</h2>      <p class="coachmark-text">Deploy sends the ready build to production.</p>      <div class="coachmark-actions">        <button type="button" class="btn btn-sm btn-quiet" value="back">Back</button>        <button type="button" class="btn btn-sm" value="done">Done</button>      </div>    </div>  </div></template>
투어를 시작해 보세요. 각 단계의 대상 주변 페이지가 어두워집니다.

그림자가 그려지지 않는 강제 색상 모드에서는 대신 시스템 강조 색상의 윤곽선으로 대상을 표시합니다.

#동작

tour는 coachmark-tour 클래스가 있는 루트 요소를 받아, 연결한 동작을 해제하는 함수를 반환합니다. @master/ui/behaviors의 attach()는 페이지의 모든 투어를 찾아 연결합니다.

app.js
import { tour } from '@master/ui/behaviors/tour.js'const root = document.querySelector('#deploys-tour')const deploys = tour(root)deploys.value = 0 // starts the tour, as the button doesroot.addEventListener('end', (event) => {  if (event.detail.completed) localStorage.setItem('deploys-tour', 'seen')})
  • 값은 투어가 표시 중인 단계의 인덱스(0부터 시작)이며, 투어가 실행 중이 아니면 null입니다. 단계를 열려면 인덱스를 설정하고, 투어를 끝내려면 null로 설정하세요. 이때 이벤트는 발행하지 않습니다.
  • 이벤트. 투어가 다른 단계로 이동할 때마다 루트는 detail.value에 인덱스를 담아 버블링되는 change를 발생시킵니다. 사용자가 투어를 끝내면 null을 담은 change를 발생시킨 뒤 end를 발생시킵니다. end의 detail.completed는 사용자가 마지막 단계까지 진행했으면 true이고, ‘건너뛰기’, Esc 등 단계를 닫는 다른 방법으로 그 전에 나갔으면 false입니다.
  • 포커스는 각 단계가 열릴 때 단계 안으로 이동합니다. autofocus가 있는 동작 버튼으로, 없으면 ‘다음’ 또는 ‘완료’ 버튼으로, 그것도 없으면 단계 자체로 이동합니다. 투어가 끝나면 포커스는 투어를 시작할 때 있던 위치로 돌아갑니다. 단, 그사이 사용자가 포커스를 페이지 안의 다른 곳으로 옮겼다면 돌아가지 않습니다.
  • 옵션. target(step, index)는 단계의 대상을 찾는 함수로, 대상을 페이지가 직접 관리할 때 사용합니다. wait는 단계가 대상을 기다리는 시간(밀리초)이며 기본값은 3000입니다.
  • 호출 명령. 브라우저가 command와 commandfor를 지원하지 않으면 동작이 시작 버튼의 클릭을 직접 감지합니다.

동작이 없으면 투어를 시작할 수 없습니다. 단계는 닫힌 상태로 남고, 페이지는 단계 없이도 온전합니다. end 이벤트로 사용자가 투어를 마쳤는지 기억해 두고, 투어를 다시 자동으로 시작하지 마세요. 나중에 찾을 수 있는 버튼에서 투어를 제공하세요.

#키보드

키동작
Enter, Space비컨에서는 연결된 코치마크를 열거나 닫습니다. 투어 단계에서는 버튼의 value에 지정된 대로 Next, Back, Skip, Done 중 하나를 실행합니다. 코치마크가 열리면 안에서 autofocus가 지정된 동작 요소가 포커스를 받으며, 그런 요소가 없는 단계는 단계 자체가 포커스를 받습니다.
Tab코치마크 안의 동작 요소 사이에서 포커스를 이동합니다. 코치마크를 벗어나면 페이지에서 비컨 다음 요소로 포커스가 이동합니다. 단계는 포커스를 붙잡아 두지 않으므로 열려 있는 동안에도 페이지를 계속 사용할 수 있습니다.
Escapepopover="auto"로 열린 코치마크를 닫고 비컨으로 포커스를 돌려보냅니다. 투어에서 단계에 포커스가 있으면 투어를 건너뛴 것으로 처리해 종료하고, 투어를 시작할 때 포커스가 있던 곳으로 포커스를 돌려보냅니다.

#접근성

  • 코치마크에 role="dialog"를 지정하고 aria-labelledby로 제목을 참조해 접근성 이름을 부여하세요. 코치마크는 비모달이므로 열린 상태에서도 주변 페이지를 사용할 수 있으며, 투어에서는 스포트라이트 아래의 페이지도 사용할 수 있습니다.
  • 비컨으로 여는 코치마크에서는 주 동작 버튼에 autofocus 속성을 지정하세요. 카드가 열리면 포커스가 카드 안으로 이동하고, 키보드에서 Enter를 눌러 계속 진행할 수 있습니다. 투어의 단계에서는 동작이 포커스를 옮깁니다.
  • 모든 단계에서 ‘건너뛰기’ 또는 ‘완료’ 버튼이나 Esc로 나갈 수 있습니다. 단일 코치마크는 바깥을 클릭해서 닫을 수도 있습니다.
  • 투어는 버튼을 누르는 등 사용자가 직접 조작할 때 시작하고, 페이지가 로드될 때 시작하지 마세요. 투어는 도움말이므로 사용자가 하려던 작업에서 포커스를 빼앗아서는 안 됩니다.
  • 투어에서 안내하는 정보는 투어 밖에서도 찾을 수 있게 하세요. 사용자가 투어 전체를 건너뛰거나 일부 단계가 건너뛰어져도 놓치는 정보가 없어야 합니다.
  • 코치마크를 마크업에서 비컨 바로 뒤에 배치하면, 카드가 화면 어디에 표시되든 탭 순서에서 비컨 바로 다음에 옵니다.

#React, Svelte, Vue

tour 컴포넌트는 데이터의 항목마다 제목, 텍스트, 진행 위치, 필요한 동작 버튼을 갖춘 단계를 하나씩 작성하고, 열린 단계의 인덱스를 주고받으며, 투어가 끝나면 onEnd로 알립니다. 단계의 대상은 선택자, 요소, ref 또는 대상을 찾는 함수로 지정합니다. npx master-ui add tour로 프로젝트에 복사하세요. 컴포넌트의 구성과 사용법은 React, Svelte, Vue에서 확인할 수 있습니다.

ui/tour.tsx
'use client'import { useId, type ComponentProps, type ReactNode, type RefObject } from 'react'import { tour } from '@master/ui/behaviors/tour.js'import { useBehavior } from './use-behavior'export interface TourStep {  /**   * What the step points at: a selector, an element, a ref, or a function that finds it. Until it is in the   * page the step waits for it, and passes on when it does not come.   */  target: string | Element | RefObject<Element | null> | (() => Element | null | undefined)  title: string  text?: string  /**   * An event on the target that moves the tour on, such as `click`: the step asks the reader to do it, and   * has no Next.   */  advance?: string}export interface TourProps extends Omit<ComponentProps<'div'>, 'children' | 'defaultValue' | 'ref'> {  steps: TourStep[]  /** The index of the open step, or null while the tour is not running. */  value?: number | null  defaultValue?: number | null  onValueChange?: (value: number | null) => void  /** Called when the reader ends the tour: completed, or left before the last step. */  onEnd?: (completed: boolean) => void  /** The button that starts the tour: spread what it is given on a button of your own. */  trigger?: (attributes: { commandfor: string, command: '--start' }) => ReactNode  /** Dim the page around each step's target. */  spotlight?: boolean  /** How long a step waits for its target, in milliseconds. */  wait?: number  nextLabel?: string  backLabel?: string  skipLabel?: string  doneLabel?: string  /** Where a step stands: `2 of 4` by default. */  countLabel?: (step: number, steps: number) => string}/** The element a step points at, found as the page is now. */function find(target: TourStep['target'] | undefined): Element | null {  if (!target) return null  if (typeof target === 'string') return document.querySelector(target)  if (typeof target === 'function') return target() ?? null  if ('current' in target) return target.current  return target}/** * A tour: one coachmark for each step, written from data, opened in turn against its target. The behavior * opens and closes the steps, waits for a target, moves focus and hears the keys; this component writes the * steps, finds their targets and passes the index of the open step in and out. */export function Tour({ steps, value, defaultValue, onValueChange, onEnd, trigger, spotlight = false, wait, nextLabel = 'Next', backLabel = 'Back', skipLabel = 'Skip', doneLabel = 'Done', countLabel = (step, count) => `${step} of ${count}`, className, id, ...root }: TourProps) {  const generated = useId()  const name = id ?? generated  const ref = useBehavior(tour, { wait, target: (_step: HTMLElement, index: number) => find(steps[index]?.target) }, {    value,    defaultValue,    onValueChange,    on: { end: event => onEnd?.((event as CustomEvent<{ completed: boolean }>).detail.completed) },  })  return (    <>      {trigger?.({ commandfor: name, command: '--start' })}      <div id={name} className={className ? `coachmark-tour ${className}` : 'coachmark-tour'} ref={ref} {...root}>        <div className={spotlight ? 'coachmark-spotlight coachmark-spotlight-dim' : 'coachmark-spotlight'} popover="manual" />        {steps.map((step, index) => {          const last = index === steps.length - 1          return (            <div className="coachmark" popover="manual" role="dialog" aria-labelledby={`${name}-${index}-title`} data-advance={step.advance} key={index}>              <p className="coachmark-count">{countLabel(index + 1, steps.length)}</p>              <h2 className="coachmark-title" id={`${name}-${index}-title`}>{step.title}</h2>              {step.text ? <p className="coachmark-text">{step.text}</p> : null}              <div className="coachmark-actions">                {last ? null : <button type="button" className="btn btn-sm btn-quiet" value="skip">{skipLabel}</button>}                {index > 0 ? <button type="button" className="btn btn-sm btn-quiet" value="back">{backLabel}</button> : null}                {step.advance ? null : <button type="button" className="btn btn-sm" value={last ? 'done' : 'next'}>{last ? doneLabel : nextLabel}</button>}              </div>            </div>          )        })}      </div>    </>  )}
ui/Tour.svelte
<script lang="ts" module>  import type { Snippet } from 'svelte'  import type { HTMLAttributes } from 'svelte/elements'  export interface TourStep {    /**     * What the step points at: a selector, an element, or a function that finds it. Until it is in the page     * the step waits for it, and passes on when it does not come.     */    target: string | Element | (() => Element | null | undefined)    title: string    text?: string    /**     * An event on the target that moves the tour on, such as `click`: the step asks the reader to do it, and     * has no Next.     */    advance?: string  }  export interface TourProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {    steps: TourStep[]    /** The index of the open step, or null while the tour is not running. Bind it, or leave it out. */    value?: number | null    onValueChange?: (value: number | null) => void    /** Called when the reader ends the tour: completed, or left before the last step. */    onEnd?: (completed: boolean) => void    /** The button that starts the tour: spread what it is given on a button of your own. */    trigger?: Snippet<[{ commandfor: string, command: '--start' }]>    /** Dim the page around each step's target. */    spotlight?: boolean    /** How long a step waits for its target, in milliseconds. */    wait?: number    nextLabel?: string    backLabel?: string    skipLabel?: string    doneLabel?: string    /** Where a step stands: `2 of 4` by default. */    countLabel?: (step: number, steps: number) => string  }</script><script lang="ts">  import { tour } from '@master/ui/behaviors/tour.js'  import { behavior } from './behavior.svelte.js'  let { steps, value = $bindable(), onValueChange, onEnd, trigger, spotlight = false, wait, nextLabel = 'Next', backLabel = 'Back', skipLabel = 'Skip', doneLabel = 'Done', countLabel = (step: number, count: number) => `${step} of ${count}`, class: className, id, ...root }: TourProps = $props()  const generated = $props.id()  const name = $derived(id ?? generated)  /** The element a step points at, found as the page is now. */  const find = (target: TourStep['target'] | undefined) => {    if (!target) return null    if (typeof target === 'string') return document.querySelector(target)    if (typeof target === 'function') return target() ?? null    return target  }  const attach = behavior(tour, () => ({ wait, target: (_step: HTMLElement, index: number) => find(steps[index]?.target) }), {    value: () => value,    change: (next) => {      value = next      onValueChange?.(next)    },    on: { end: event => onEnd?.((event as CustomEvent<{ completed: boolean }>).detail.completed) },  })</script><!--  @component  A tour: one coachmark for each step, written from data, opened in turn against its target. The behavior  opens and closes the steps, waits for a target, moves focus and hears the keys; this component writes the  steps, finds their targets and passes the index of the open step in and out.-->{@render trigger?.({ commandfor: name, command: '--start' })}<div id={name} class={['coachmark-tour', className]} {@attach attach} {...root}>  <div class={spotlight ? 'coachmark-spotlight coachmark-spotlight-dim' : 'coachmark-spotlight'} popover="manual"></div>  {#each steps as step, index (index)}    {@const last = index === steps.length - 1}    <div class="coachmark" popover="manual" role="dialog" aria-labelledby="{name}-{index}-title" data-advance={step.advance}>      <p class="coachmark-count">{countLabel(index + 1, steps.length)}</p>      <h2 class="coachmark-title" id="{name}-{index}-title">{step.title}</h2>      {#if step.text}<p class="coachmark-text">{step.text}</p>{/if}      <div class="coachmark-actions">        {#if !last}<button type="button" class="btn btn-sm btn-quiet" value="skip">{skipLabel}</button>{/if}        {#if index > 0}<button type="button" class="btn btn-sm btn-quiet" value="back">{backLabel}</button>{/if}        {#if !step.advance}<button type="button" class="btn btn-sm" value={last ? 'done' : 'next'}>{last ? doneLabel : nextLabel}</button>{/if}      </div>    </div>  {/each}</div>
ui/Tour.vue
<script lang="ts">export interface TourStep {  /**   * What the step points at: a selector, an element, or a function that finds it. Until it is in the page the   * step waits for it, and passes on when it does not come.   */  target: string | Element | (() => Element | null | undefined)  title: string  text?: string  /**   * An event on the target that moves the tour on, such as `click`: the step asks the reader to do it, and has   * no Next.   */  advance?: string}</script><script setup lang="ts">import { computed, useId, useTemplateRef } from 'vue'import { tour } from '@master/ui/behaviors/tour.js'import { useBehavior } from './use-behavior'defineOptions({ inheritAttrs: false })const { steps, id, spotlight = false, wait, nextLabel = 'Next', backLabel = 'Back', skipLabel = 'Skip', doneLabel = 'Done', countLabel = (step: number, count: number) => `${step} of ${count}` } = defineProps<{  steps: TourStep[]  id?: string  /** Dim the page around each step's target. */  spotlight?: boolean  /** How long a step waits for its target, in milliseconds. */  wait?: number  nextLabel?: string  backLabel?: string  skipLabel?: string  doneLabel?: string  /** Where a step stands: `2 of 4` by default. */  countLabel?: (step: number, steps: number) => string}>()/** The index of the open step, or null while the tour is not running: `v-model`. */const model = defineModel<number | null>()const emit = defineEmits<{  /** The reader ended the tour: completed, or left before the last step. */  end: [completed: boolean]}>()defineSlots<{  /** The button that starts the tour: bind what it is given on a button of your own. */  trigger?: (attributes: { commandfor: string, command: '--start' }) => unknown}>()/* * A tour: one coachmark for each step, written from data, opened in turn against its target. The behavior * opens and closes the steps, waits for a target, moves focus and hears the keys; this component writes the * steps, finds their targets and passes the index of the open step in and out. */const generated = useId()const name = computed(() => id ?? generated)const root = useTemplateRef<HTMLDivElement>('root')/** The element a step points at, found as the page is now. */const find = (target: TourStep['target'] | undefined) => {  if (!target) return null  if (typeof target === 'string') return document.querySelector(target)  if (typeof target === 'function') return target() ?? null  return target}useBehavior(root, tour, () => ({ wait, target: (_step: HTMLElement, index: number) => find(steps[index]?.target) }), model, {  end: event => emit('end', (event as CustomEvent<{ completed: boolean }>).detail.completed),})</script><template>  <slot name="trigger" v-bind="{ commandfor: name, command: '--start' as const }" />  <div :id="name" class="coachmark-tour" ref="root" v-bind="$attrs">    <div :class="spotlight ? 'coachmark-spotlight coachmark-spotlight-dim' : 'coachmark-spotlight'" popover="manual" />    <div v-for="(step, index) in steps" :key="index" class="coachmark" popover="manual" role="dialog" :aria-labelledby="`${name}-${index}-title`" :data-advance="step.advance">      <p class="coachmark-count">{{ countLabel(index + 1, steps.length) }}</p>      <h2 :id="`${name}-${index}-title`" class="coachmark-title">{{ step.title }}</h2>      <p v-if="step.text" class="coachmark-text">{{ step.text }}</p>      <div class="coachmark-actions">        <button v-if="index < steps.length - 1" type="button" class="btn btn-sm btn-quiet" value="skip">{{ skipLabel }}</button>        <button v-if="index > 0" type="button" class="btn btn-sm btn-quiet" value="back">{{ backLabel }}</button>        <button v-if="!step.advance" type="button" class="btn btn-sm" :value="index === steps.length - 1 ? 'done' : 'next'">{{ index === steps.length - 1 ? doneLabel : nextLabel }}</button>      </div>    </div>  </div></template>

#브라우저 지원

코치마크는 CSS 앵커 위치 지정으로 배치합니다. 카드에는 position-area와 position-try-fallbacks를 사용하고, 화살표와 투어의 스포트라이트를 배치할 때는 카드와 화살표가 가리키는 요소 사이에 anchor()를 사용합니다. 앵커 위치 지정을 지원하지 않는 브라우저에서도 카드는 열리고 닫힙니다. 이때 카드는 브라우저의 기본 팝오버 위치인 뷰포트 중앙에 표시되고 화살표는 표시되지 않습니다. 스포트라이트는 대상을 밝게 남길 수 없으므로 아무것도 어둡게 하지 않습니다. showPopover()의 source 옵션으로 투어 단계에 앵커를 지정할 수 있습니다. 이 옵션이 없으면 단계가 앵커 없이 열립니다. 시작 버튼은 호출 명령을 사용하며, 이를 지원하지 않는 브라우저에서는 동작이 대신 처리합니다. 페이드와 짧은 슬라이드에는 @starting-style 규칙을 사용합니다. 이를 지원하지 않으면 카드와 배경막이 즉시 나타나고 사라집니다.

카드가 열릴 때는 서서히 나타나며 앵커 쪽으로 4px 이동하고, 닫힐 때는 더 짧은 페이드로 사라집니다. 다른 팝오버에서 사용하는 크기 전환을 카드에 적용하면 화살표가 카드 안쪽에 머물러 대상 요소 쪽으로 충분히 뻗지 못하므로, 코치마크의 크기는 전환 중에도 일정하게 유지합니다.

#클래스

클래스설명
coachmark전경색을 바탕으로 하는 카드입니다. popover 속성과 role="dialog"를 지정한 요소에 적용하고, 카드 제목을 접근성 이름으로 사용합니다. popover 속성이 없으면 카드는 표시되지 않습니다. 너비는 18rem이며, 카드를 연 요소 아래에 가운데를 맞춰 열립니다. 아래에 공간이 부족하면 위로 열립니다. 화살표는 마크업에서 카드 바로 앞에 있는 요소를 가리키므로, 카드를 비컨이나 설명 대상 컨트롤 바로 뒤에 배치하세요.
coachmark-top위쪽 공간을 우선 사용합니다. 화면 하단에 가까운 컨트롤이나 컨트롤의 위쪽 모서리에 있는 비컨에 적합합니다.적용할 클래스는 coachmark입니다
coachmark-count제목 위에 덜 강조된 글자색으로 짧은 문구를 한 줄 표시합니다. 투어의 현재 단계(4단계 중 2단계)나 ‘신규’ 같은 단어를 넣습니다.
coachmark-title코치마크의 레이블로 쓰이는 단계 제목
coachmark-text컨트롤이 하는 일을 설명하는 한두 문장입니다
coachmark-actions카드 하단에 작은 버튼을 한 줄로 배치하고, 카드 가장자리와는 12px 간격을 둡니다. 버튼이 여러 개면 첫 번째 버튼(건너뛰기)은 시작 쪽에, 나머지 버튼(이전, 다음)은 끝 쪽에 둡니다. 기본 버튼은 전경색 바탕 위에서 동작을 강조하며, 강조를 낮춘 버튼은 카드의 전경색을 따릅니다.
coachmark-tour투어의 단계와 스포트라이트를 담습니다. 각 단계는 popover="manual"이 지정된 코치마크이며 진행 순서대로 배치합니다. tour 동작이 이 요소에 연결되므로 투어를 시작하는 버튼이 가리킬 수 있도록 id를 지정하세요. 자체적으로 그리는 것은 없으며, 화살표가 가리키는 대상의 앵커 이름은 이 요소 안에서만 유효합니다.
coachmark-spotlight투어가 각 단계를 열기 전에 해당 단계의 대상 위에 여는 빈 팝오버입니다. 대상과 그 주변 4px을 덮으며, 단계가 마크업의 어디에 있든 열린 단계의 화살표는 이 팝오버를 가리킵니다. 그 자체로는 아무것도 그리지 않으며 포인터 입력을 통과시킵니다.
coachmark-spotlight-dim대화 상자의 배경막으로 대상 주변의 페이지를 어둡게 하고 대상은 밝게 남겨 둡니다. 배경막 아래의 페이지는 계속 사용할 수 있습니다. 강제 색상 모드에서는 대신 시스템 강조 색상의 윤곽선으로 대상을 표시합니다.적용할 클래스는 coachmark-spotlight입니다
coachmark-beacon단계의 위치를 표시하고 popovertarget으로 해당 코치마크를 여는 10px 크기의 전경색 점입니다. 평소에는 고리가 간헐적으로 퍼져 나갑니다. 포인터가 점 위에 있거나 점에 포커스가 있거나 코치마크가 열려 있을 때, 또는 동작 줄이기가 적용될 때는 고리가 움직이지 않고 점을 둘러쌉니다. 조작 영역은 24px이며 터치 화면에서는 44px입니다. 페이지에서 위치를 지정하며, 보통 안내 대상 컨트롤의 위쪽 모서리에 배치합니다.

#사용자 지정 속성

속성기본값설명
--coachmark-width18rem카드의 너비입니다. 뷰포트 너비에서 1rem을 뺀 값을 넘지 않습니다.
--coachmark-inset12px동작 버튼과 카드 가장자리 사이의 간격입니다. 텍스트는 가장자리에서 4px 더 떨어져 있습니다. 카드 모서리 반경은 작은 버튼의 모서리 반경에 이 안쪽 여백을 더한 값입니다.
--coachmark-arrow7px화살표 끝이 카드 밖으로 돌출되는 거리입니다
--anchored-gapcalc(var(--coachmark-arrow) + 6px)카드와 카드를 연 요소 사이 간격. 화살표 끝은 그 요소에서 6px 떨어져 있습니다.
--coachmark-beacon-size.625rem비컨 점의 지름coachmark-beacon에 설정합니다
--coachmark-spotlight-inset4px스포트라이트가 대상의 각 변 바깥으로 확장되는 거리coachmark-spotlight에 설정합니다
--coachmark-spotlight-radiusvar(--radius-control)스포트라이트가 비추는 대상의 모서리 반경입니다. 스포트라이트의 모서리 반경은 이 값에 확장 거리를 더한 값입니다.coachmark-spotlight에 설정합니다

#소스

@master/ui/components/coachmark.css
/* * Coachmark: one step of a tour, pointing at the control it explains. * It is a popover of ink: a small card of the inverse surface sheet-inverse is made of, laid flat so its arrow * joins it without a seam. It stands apart from the sheets of ordinary popovers and from the page under it. * Anchor positioning centers it under the element that opened it (popovertarget, commandfor, or the source a * script passes to showPopover) and flips it above at the viewport's edge. It enters with a fade and slides 4px * toward that element. * An arrow of the same ink points at the element right before the coachmark in the markup, which is its beacon * or the control it explains: while the coachmark is open that element is named as an anchor, and the arrow * follows its middle when an edge pushes the card aside and moves to the other edge when the card flips. * Geometry: 12px between the actions and the card's edge, so the card's corner is a small button's corner plus * that inset, and a 7px arrow whose two flanks carry the card's contour into its point. * A beacon marks where a step is and is the button that opens it: a 10px ink dot that sends out a ring now and * then. Under the pointer, with focus, while its step is open and with reduced motion, the ring rests as a halo. * Without anchor positioning the card opens where the browser places a popover, centered, with no arrow. * A tour holds its steps in coachmark-tour, which keeps the name of what its arrows point at to itself. Its * spotlight is an empty popover the tour opens over each step's target with that target as its anchor: it * covers the target and 4px around it, so the card's arrow points there wherever the step stands in the * markup. It draws nothing by itself; dimmed, a ring of scrim as wide as the screen leaves the target lit, * and in forced colors, where shadows are gone, a system-color outline marks the target instead. The scrim * is paint only: the page under it still answers the pointer and the keys. */@layer components.ui {  .coachmark {    --coachmark-inset: 12px;    --coachmark-width: 18rem;    --coachmark-arrow: 7px;    --anchored-gap: calc(var(--coachmark-arrow) + 6px);    --anchored-inline: span-all;    --surface-color: var(--color-surface-inverse);    /* Focus rings stand on ink, so they are drawn in the ink of the words. */    --color-focus: var(--color-text-inverse);    @apply --on-ink;    flex-direction: column;    gap: .25rem;    width: min(var(--coachmark-width), calc(100vw - 1rem));    padding: calc(var(--coachmark-inset) + 4px) calc(var(--coachmark-inset) + 4px) var(--coachmark-inset);    border: 0;    border-radius: calc(var(--radius-control-sm) * var(--corner-scale) + var(--coachmark-inset));    corner-shape: var(--corner-shape);    overflow: visible;    background: var(--color-surface-inverse);    color: var(--color-text-inverse);    box-shadow:      inset 0 .5px 0 var(--color-ink-highlight),      0 0 0 .5px var(--color-ink-edge),      0 1px 2px -1px var(--color-shade-1), 0 3px 6px -3px var(--color-shade-2), 0 6px 12px -6px var(--color-shade-3),      0 12px 24px -12px var(--color-shade-4), 0 24px 48px -24px var(--color-shade-5);    font: 400 .8125rem/1.5 var(--font-family-sans);    font-feature-settings: inherit;    overflow-wrap: anywhere;    overscroll-behavior: contain;    @apply --anchored;    /*     * In and out of the top layer. Not --pop: a scale would make the card the containing block of its arrow,     * which could then no longer reach the element it points at. Closed is where it leaves to.     */    opacity: 0;    transition-property: opacity, margin, overlay, display;    transition-duration: var(--duration-quick);    transition-timing-function: var(--easing-glide);    transition-behavior: allow-discrete;    &:popover-open {      display: flex;      opacity: 1;      transition-duration: var(--duration-base);      @starting-style {        opacity: 0;      }    }    /* Prefer the space above. */    &.coachmark-top {      --anchored-block: block-start;    }    /* A step with no action to focus is focused itself, as a dialog is, and reads as its title. */    &:focus-visible {      outline: none;    }    @media (forced-colors: active) {      &, &:focus-visible {        outline: 1px solid CanvasText;        outline-offset: -1px;      }    }  }  /*   * The spotlight: an empty popover, nothing of the browser's own box. Where anchor positioning is missing it   * stays a point, and dims nothing it could not leave a hole in.   */  .coachmark-spotlight {    --coachmark-spotlight-inset: 4px;    --coachmark-spotlight-radius: var(--radius-control);    width: 0;    height: 0;    margin: 0;    padding: 0;    border: 0;    overflow: visible;    background: none;    pointer-events: none;  }  /*   * Placed: a half-rem from the viewport's sides when an edge pushes it aside, and only a flip to the other side   * of its anchor. It travels 4px toward the anchor as it enters and 2px away as it leaves; margins are swapped   * with the flip, so the travel follows the side it opened on.   */  @supports (position-area: block-end) {    .coachmark {      --coachmark-travel: 2px;      margin: calc(var(--anchored-gap) + var(--coachmark-travel)) .5rem;      position-try-fallbacks: flip-block;      anchor-name: --coachmark-card;      anchor-scope: --coachmark-card;      &:popover-open {        --coachmark-travel: 0px;        @starting-style {          --coachmark-travel: 4px;        }      }      @media (prefers-reduced-motion: reduce) {        &, &:popover-open {          --coachmark-travel: 0px;        }      }      /*       * The arrow: a square turned a quarter, its middle on the edge of the card that faces the element it       * points at, and a patch of the card's ink over its inner half, so only the point outside the card is       * seen. Both lie over the card's face and under its content, so the point covers the card's contour where       * they join and its own contour carries the card's into the point.       * They are fixed to the viewport and placed with anchor(), between that element and the card itself:       * across, at the element's middle, but never into the card's rounded corners; up and down, at whichever       * of the card's edges is nearer to it. With no element to point at, they meet in the card's middle, where       * the patch hides the arrow.       */      &::before, &::after {        --coachmark-arrow-side: calc(var(--coachmark-arrow) * 1.4142);        --coachmark-arrow-reach: calc(var(--radius-control-sm) * var(--corner-scale) + var(--coachmark-inset) + var(--coachmark-arrow));        --coachmark-arrow-x: clamp(          anchor(--coachmark-card left, 0px) + var(--coachmark-arrow-reach),          anchor(--coachmark-target center, anchor(--coachmark-card center, 0px)),          anchor(--coachmark-card right, 0px) - var(--coachmark-arrow-reach)        );        --coachmark-arrow-y: clamp(          anchor(--coachmark-card top, 0px),          anchor(--coachmark-target center, anchor(--coachmark-card center, 0px)),          anchor(--coachmark-card bottom, 0px)        );        content: '';        position: fixed;        z-index: -1;        background: var(--color-surface-inverse);        pointer-events: none;      }      &::before {        top: calc(var(--coachmark-arrow-y) - var(--coachmark-arrow-side) / 2);        left: calc(var(--coachmark-arrow-x) - var(--coachmark-arrow-side) / 2);        width: var(--coachmark-arrow-side);        height: var(--coachmark-arrow-side);        border-radius: 2px;        /* The light catches the two flanks that face up, which the patch hides when the arrow points down. */        box-shadow: inset .5px .5px 0 var(--color-ink-highlight), 0 0 0 .5px var(--color-ink-edge);        rotate: 45deg;      }      &::after {        top: clamp(          anchor(--coachmark-card top, 0px),          var(--coachmark-arrow-y) - var(--coachmark-arrow) - 1px,          anchor(--coachmark-card bottom, 0px) - var(--coachmark-arrow) * 2 - 2px        );        left: calc(var(--coachmark-arrow-x) - var(--coachmark-arrow) - .5px);        width: calc(var(--coachmark-arrow) * 2 + 1px);        height: calc(var(--coachmark-arrow) * 2 + 2px);      }      /*       * Forced colors repaint both as the canvas, and the card would point at nothing: the arrow is kept in the       * system's text color, and the patch in the canvas the card is repainted with.       */      @media (forced-colors: active) {        &::before, &::after {          forced-color-adjust: none;        }        &::before {          background: CanvasText;          box-shadow: none;        }        &::after {          background: Canvas;        }      }    }    /* The element right before an open coachmark is what its arrow points at. */    :where(:has(+ .coachmark:popover-open)) {      anchor-name: --coachmark-target;    }    /* A tour keeps the name to itself, so the arrows of its steps find its spotlight and no other. */    .coachmark-tour {      anchor-scope: --coachmark-target;    }    /*     * Over the target the tour opened it against, and 4px around it, with the corner of a control plus that     * inset. It is what the arrow of the open step points at.     */    .coachmark-spotlight {      /* The element it was opened against; anchor() alone does not reach for it as position-area does. */      position-anchor: auto;      inset: auto;      top: anchor(top);      right: anchor(right);      bottom: anchor(bottom);      left: anchor(left);      width: auto;      height: auto;      margin: calc(var(--coachmark-spotlight-inset) * -1);      border-radius: calc(var(--coachmark-spotlight-radius) * var(--corner-scale) + var(--coachmark-spotlight-inset));      corner-shape: var(--corner-shape);      anchor-name: --coachmark-target;      /*       * Dimmed: a scrim as wide as the screen, drawn as the spotlight's ring, so the target stays lit. It       * fades in as the tour starts and out as it ends, a fade reduced motion keeps; from one step to the       * next the hole moves at once, so there is no travel to take away.       */      &.coachmark-spotlight-dim {        box-shadow: 0 0 0 100vmax var(--color-surface-scrim);        opacity: 0;        transition-property: opacity, overlay, display;        transition-duration: var(--duration-quick);        transition-timing-function: var(--easing-glide);        transition-behavior: allow-discrete;        &:popover-open {          opacity: 1;          transition-duration: var(--duration-base);          @starting-style {            opacity: 0;          }        }        /* Shadows are gone in forced colors: the target is marked by an outline of the system's highlight. */        @media (forced-colors: active) {          outline: 2px solid Highlight;        }      }    }  }  /* Where the step stands in the tour: "2 of 4". */  .coachmark-count {    margin: 0;    color: color-mix(in oklab, currentColor 62%, transparent);    font-size: .75rem;    font-weight: var(--font-weight-control);    font-variant-numeric: tabular-nums;    line-height: 1.4;  }  .coachmark-title {    margin: 0;    color: inherit;    font: var(--font-weight-control) .875rem/1.4 var(--font-family-sans);    font-feature-settings: inherit;    text-wrap: balance;  }  .coachmark-text {    margin: 0;    color: color-mix(in oklab, currentColor 76%, transparent);    text-wrap: pretty;  }  /*   * The actions, along the foot: 12px from the card's edges, so a small button's corner nests in the card's.   * The first of several stands at the start (Skip, or Back), the others at the end.   */  .coachmark-actions {    display: flex;    flex-wrap: wrap;    align-items: center;    justify-content: flex-end;    gap: .25rem;    margin: .625rem -4px 0;    .btn:first-child:not(:only-child) {      margin-inline-end: auto;    }    /*     * The first is the first the row draws: a button left hidden on this step, such as Back on the first, is     * not counted, and a button left alone beside a hidden one stays at the end.     */    .btn:nth-child(1 of :not([hidden])) {      margin-inline-end: auto;    }    .btn:nth-child(1 of :not([hidden])):nth-last-child(1 of :not([hidden])) {      margin-inline-end: 0;    }  }  /*   * A quiet button on ink takes a quieter step of the card's ink, and a tint of it under the pointer; busy, it   * does not answer the pointer. These rules outweigh the quiet button's own hover, which would otherwise lay   * a pearl sheet in the strong ink of a page on the card.   */  .coachmark .btn.btn-quiet:not(:disabled, [aria-disabled="true"]) {    color: color-mix(in oklab, var(--color-text-inverse) 72%, transparent);    @media (hover: hover) {      &:hover:not([aria-busy="true"]) {        background: color-mix(in oklab, var(--color-text-inverse) 12%, transparent);        color: var(--color-text-inverse);        box-shadow: none;      }    }    &:active:not([aria-busy="true"]) {      background: color-mix(in oklab, var(--color-text-inverse) 18%, transparent);      color: var(--color-text-inverse);      box-shadow: none;    }  }  /*   * The beacon: a 10px dot of ink with a rim of the surface it stands on, and a ring that leaves it now and then   * to say there is something to see. The page places it, beside or on the corner of what it marks; its target   * is 24px, and 44px on a touch screen.   */  .coachmark-beacon {    --coachmark-beacon-size: .625rem;    position: relative;    display: inline-block;    flex: none;    width: var(--coachmark-beacon-size);    height: var(--coachmark-beacon-size);    margin: 0;    padding: 0;    border: 0;    border-radius: 999px;    corner-shape: round;    background: var(--color-surface-inverse);    box-shadow: 0 0 0 2px var(--surface-color, var(--color-surface-base)), 0 1px 3px 1.5px var(--color-shade-1);    vertical-align: middle;    appearance: none;    cursor: pointer;    touch-action: manipulation;    -webkit-tap-highlight-color: transparent;    transition: scale var(--duration-quick) var(--easing-glide);    /* The ring that leaves the dot. */    &::before {      content: '';      position: absolute;      inset: 0;      border-radius: inherit;      corner-shape: inherit;      box-shadow: 0 0 0 0 transparent;      pointer-events: none;      animation: coachmark-beacon 2.4s var(--easing-glide) infinite;    }    /* The target a pointer and a finger need, around the dot. */    &::after {      content: '';      position: absolute;      inset: calc((var(--coachmark-beacon-size) - 1.5rem) / 2);      @media (pointer: coarse) {        inset: calc((var(--coachmark-beacon-size) - 2.75rem) / 2);      }    }    @media (hover: hover) {      &:hover {        scale: 1.2;      }      &:hover::before {        box-shadow: 0 0 0 4px color-mix(in oklab, var(--color-surface-inverse) 14%, transparent);        animation: none;      }    }    &:active {      scale: .9;      transition-duration: var(--duration-press);    }    &:focus-visible {      @apply --focus-ring;      outline-offset: 4px;    }    /* Found: while it has focus or its step is open, the ring rests as a halo, as it does under the pointer. */    &:is(:focus-visible, :has(+ .coachmark:popover-open))::before {      box-shadow: 0 0 0 4px color-mix(in oklab, var(--color-surface-inverse) 14%, transparent);      animation: none;    }    @media (prefers-reduced-motion: reduce) {      transition: none;      &::before {        box-shadow: 0 0 0 4px color-mix(in oklab, var(--color-surface-inverse) 14%, transparent);        animation: none;      }      &:hover, &:active {        scale: none;      }    }    @media (forced-colors: active) {      outline: 2px solid ButtonText;      outline-offset: -2px;      background: ButtonText;      &::before {        animation: none;      }      /* The halo is a shadow, gone here: found, the dot takes the system's highlight instead. */      &:has(+ .coachmark:popover-open) {        outline-color: Highlight;        background: Highlight;      }      /* Keyboard focus is a ring of the highlight, as on a button. */      &:focus-visible {        outline: 2px solid Highlight;        outline-offset: 4px;      }    }  }}@keyframes coachmark-beacon {  0%, 20% {    box-shadow: 0 0 0 0 color-mix(in oklab, var(--color-surface-inverse) 42%, transparent);  }  75%, 100% {    box-shadow: 0 0 0 .625rem transparent;  }}