# Fastmail · 메일을 밀어서 보관하거나 삭제하기

모바일 메일 목록의 기본 설정에서는 메시지를 오른쪽으로 밀면 보관하고 왼쪽으로 밀면 삭제합니다. 설정에서 왼쪽·오른쪽 각각 짧게 밀 때와 길게 밀 때의 동작을 바꿀 수 있습니다.

[공식 원문](https://www.fastmail.help/hc/en-us/articles/4763978773007-Custom-swipes)

## 관련 모션 · 스와이프 행 작업

# 스와이프 행 작업 (Swipe Actions)

목록 행을 옆으로 밀어 그 항목을 보관하거나 다시 꺼냅니다.

## 체험 방법

항목을 왼쪽으로 밀거나 작업 버튼을 누른 뒤 보관을 선택하세요. 보관함에서 다시 꺼낼 수 있습니다.

## 재현 기준

행을 38px 넘게 밀면 작업 영역 90px가 드러납니다. 동작을 따로 눌러 확정합니다. 한 번에 한 행만 열리고 Escape나 같은 버튼으로 닫습니다. 처리한 뒤 남은 항목 또는 현재 목록 탭으로 초점이 돌아갑니다.

## 기기별 조작

- iOS · 서신을 왼쪽으로 쓸어 보관 버튼을 드러내세요. 작업을 눌러도 같은 메뉴가 열립니다.
- Android · 서신을 왼쪽으로 밀거나 오른쪽의 작업을 누른 뒤 보관을 선택하세요.
- PC · 행의 작업 버튼을 누르고 Tab으로 보관 버튼에 이동하세요. 마우스로 행을 끌어도 됩니다.

## 적용할 때

받은 편지함이나 검토 대기열에서 목록을 벗어나지 않고 항목을 처리할 때.

## 그대로 보낼 요청

> 왼쪽으로 밀면 행 뒤의 보관 버튼이 보이고 보관함에서 원래 항목을 되돌릴 수 있게 해줘.

## 참고한 동작

[Apple Developer · SwiftUI swipeActions](https://developer.apple.com/documentation/swiftui/view/swipeactions(edge:allowsfullswipe:content:))

## 독립 실행 코드

아래 전체 코드를 HTML로 저장해 브라우저에서 엽니다.

```html
<!doctype html>
<html lang="ko"><head><script>if(new URLSearchParams(location.search).get('reduce')==='1')document.documentElement.classList.add('motion-reduced');</script><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>스와이프 행 작업 · Motion Lab</title>
<style>
*{box-sizing:border-box}html{color-scheme:light}body{margin:0;font:15px/1.5 system-ui,-apple-system,'Malgun Gothic',sans-serif;word-break:keep-all}main{margin:auto}button{font:inherit;color:inherit;cursor:pointer}button:focus-visible,[tabindex]:focus-visible{outline:3px solid #005bc6;outline-offset:2px}button:disabled{cursor:default}h1,h2,p{margin:0}h1{font-size:clamp(26px,5vw,42px);font-weight:750;letter-spacing:-.075em;line-height:1.2}h2{font-size:18px;letter-spacing:-.04em}.mono{font:600 11px/1.4 ui-monospace,Consolas,monospace;letter-spacing:.055em}.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}button{touch-action:manipulation}html.motion-reduced *,html.motion-reduced *::before,html.motion-reduced *::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}

body{color:#1b2841;background:#d4dde5}main{width:min(100%,610px);padding:clamp(14px,3.5vw,30px)}.mail{padding:clamp(15px,4vw,31px);background:#f2eee1;border-top:8px solid #223c61;box-shadow:5px 6px 0 #a8b4bf}.mast{display:flex;align-items:center;justify-content:space-between;color:#304763}.mast i{display:block;width:47px;height:19px;background:repeating-linear-gradient(118deg,transparent 0 6px,#ab4d37 6px 12px,transparent 12px 18px,#2a4566 18px 24px)}h1{margin:7px 0 17px}.folders{display:flex;border-bottom:1px solid #263951;gap:4px}.folders button{padding:8px 11px;min-height:44px;border:0;background:none;font-weight:700;color:#465160}.folders button[aria-pressed=true]{box-shadow:inset 0 -3px #263951;color:#172d4c}.folders small{font-size:11px}.list{padding:0;margin:6px 0;list-style:none}.row{position:relative;overflow:hidden;border-bottom:1px solid #b7bbc1;isolation:isolate}.front{display:flex;align-items:center;gap:13px;position:relative;z-index:1;text-align:left;width:100%;min-height:64px;padding:6px 3px;border:0;background:#f2eee1;touch-action:pan-y;transition:transform .24s cubic-bezier(.2,.74,.22,1);user-select:none}.front:focus-visible{outline-offset:-3px}.front small{display:block;color:#536071;font-size:11px}.front strong{font-size:16px}.stamp{display:grid;place-items:center;width:38px;height:40px;flex:none;border:2px dotted #efeada;outline:1px solid #69788b;background:var(--ink);color:#fff;font:italic 700 22px Georgia,serif}.mark{margin-left:auto;min-width:40px;text-align:center;font-size:12px;color:#39485e}.operation{position:absolute;top:0;bottom:0;right:0;width:90px;color:#fff;background:#324e72;border:0;font-weight:700}.operation:focus-visible{outline:3px solid #ffc07b;outline-offset:-5px}.row.open .front{transform:translateX(-90px)}.row.drag .front{transition:none}.foot{font-size:12px;color:#48536a;min-height:24px;padding-top:3px}#empty{padding:32px 0;text-align:center;color:#545968}@media(max-width:370px){.front{gap:9px}.stamp{width:31px;height:35px}.front strong{font-size:14px}}

</style></head><body>

<main><section class="mail"><div class="mast"><span class="mono">STUDIO POST / 교정 서신</span><i aria-hidden="true"></i></div><h1>교정 우편함</h1><nav class="folders" aria-label="우편함 선택"><button id="inbox" type="button" aria-pressed="true">받은 편지 <small></small></button><button id="archive" type="button" aria-pressed="false">보관함 <small></small></button></nav>
<ul class="list" id="list" aria-label="교정 서신"></ul><p id="empty" hidden>이 우편함에 편지가 없습니다.</p><p class="foot" role="status" id="notice">행을 왼쪽으로 밀거나 작업 버튼을 누르세요.</p></section></main>

<script>

const records=[{name:'잉크 농도 확인',sender:'혼합실',mark:'a',ink:'#71443c'},{name:'봉투 접지선 수정',sender:'제본실',mark:'b',ink:'#354e68'},{name:'표지 최종 승인',sender:'편집실',mark:'c',ink:'#4b6050'}];
let folder=false,opened=null;const list=document.querySelector('#list'),notice=document.querySelector('#notice');
const inbox=document.querySelector('#inbox'),archive=document.querySelector('#archive');
function closeRow(){if(!opened)return;opened.classList.remove('open');opened.querySelector('.front').setAttribute('aria-expanded','false');opened.querySelector('.operation').inert=true;opened=null;}
function reveal(row,show){closeRow();if(show){opened=row;row.classList.add('open');row.querySelector('.operation').inert=false;row.querySelector('.front').setAttribute('aria-expanded','true');}}
function paint(){
  opened=null;list.replaceChildren();const saved=records.filter(x=>x.saved).length;
  inbox.querySelector('small').textContent=records.length-saved;archive.querySelector('small').textContent=saved;
  inbox.setAttribute('aria-pressed',String(!folder));archive.setAttribute('aria-pressed',String(folder));
  for(const item of records.filter(x=>Boolean(x.saved)===folder)){
    const row=document.createElement('li');row.className='row';
    row.innerHTML='<button type="button" class="front" aria-expanded="false"><i class="stamp" aria-hidden="true"></i><span><small></small><strong></strong></span><span class="mark">작업 ⋯</span></button><button class="operation" type="button"></button>';
    const front=row.querySelector('.front'),act=row.querySelector('.operation');
    front.setAttribute('aria-label',item.name+' 작업');front.setAttribute('aria-controls','act-'+item.mark);
    row.querySelector('.stamp').textContent=item.mark;row.style.setProperty('--ink',item.ink);
    row.querySelector('small').textContent=item.sender;row.querySelector('strong').textContent=item.name;
    act.id='act-'+item.mark;act.inert=true;act.textContent=folder?'꺼내기':'보관';act.setAttribute('aria-label',item.name+' '+act.textContent);
    let drag=null,ignoreClick=false;
    front.addEventListener('pointerdown',e=>{if(e.button!==0||!e.isPrimary)return;ignoreClick=false;drag={id:e.pointerId,x:e.clientX,y:e.clientY,start:row===opened?-90:0,dx:0};front.setPointerCapture(e.pointerId);});
    front.addEventListener('pointermove',e=>{if(!drag||e.pointerId!==drag.id)return;drag.dx=e.clientX-drag.x;const dy=e.clientY-drag.y;if(!drag.axis&&Math.max(Math.abs(drag.dx),Math.abs(dy))>6)drag.axis=Math.abs(drag.dx)>Math.abs(dy)?'x':'y';if(drag.axis!=='x')return;row.classList.add('drag');const dx=Math.min(0,Math.max(-90,drag.start+drag.dx));front.style.transform='translateX('+dx+'px)';});
    function end(e){if(!drag||e.pointerId!==drag.id)return;const d=drag;drag=null;front.style.removeProperty('transform');row.classList.remove('drag');if(e.type!=='pointerup'||d.axis==='y'){ignoreClick=true;return;}if(d.axis==='x'){ignoreClick=true;reveal(row,d.start+d.dx<=-38);}}
    front.addEventListener('keydown',e=>{if(e.key==='Escape'&&drag){end({pointerId:drag.id,type:'cancel'});e.stopPropagation();}});
    ['pointerup','pointercancel','lostpointercapture'].forEach(type=>front.addEventListener(type,end));
    front.addEventListener('click',e=>{if(ignoreClick&&e.detail!==0){ignoreClick=false;return;}reveal(row,opened!==row);});
    act.addEventListener('click',()=>{item.saved=!folder;notice.textContent=item.name+(folder?' · 받은 편지로 이동':' · 보관함으로 이동');const index=[...list.children].indexOf(row);paint();const next=list.children[Math.min(index,list.children.length-1)];(next?.querySelector('.front')||(folder?archive:inbox)).focus({preventScroll:true});});
    list.append(row);
  }
  document.querySelector('#empty').hidden=Boolean(list.children.length);
}
document.addEventListener('keydown',e=>{if(e.key==='Escape'&&opened){const b=opened.querySelector('.front');closeRow();b.focus();}});
for(const [button,isArchive] of [[inbox,false],[archive,true]])button.addEventListener('click',()=>{folder=isArchive;notice.textContent='행을 왼쪽으로 밀거나 작업 버튼을 누르세요.';paint();});
paint();

</script></body></html>
```

