-- select 에는 placeholder 가 없다 → 값이 "" 인 첫 option 이 그 노릇을 한다placeholderOption :: String -> OptionplaceholderOption label = Option { value = "", disabled = True, hidden = True, text = label }valid :: Select -> Boolvalid s = not (required s) || value s /= "" -- required 면 placeholder label option 으로는 제출이 막힌다-- React: <option selected> 대신 <select defaultValue="">
-- web.dev 글은 다중 선택을 checkbox · select 두 방식으로 만든다. 여기 남긴 건 그 곁의 개수 세기·모바일 판별-- 선택 개수: JS 없이 CSS 카운터로filters :: [Input] -> Intfilters = length . filter checked -- counter-reset → :checked 마다 counter-increment-- aside::after { content: counter(filters) }-- 모바일 판별: @media (pointer: coarse)
-- CSS 한 줄로 내용 기반 크기 조절 — textarea 뿐 아니라 select·input 에도size :: FieldSizing -> Element -> Sizesize Fixed el = defaultSize el -- 기본: 고정 크기, 넘치면 스크롤size Content el = contentSize el -- 내용만큼 — JS 로 높이를 재던 자동 크기 조절이 필요 없다-- textarea, select, input { field-sizing: content; }