Repository navigation
fix(components): give each Select trigger its own id - #801
Merged
Merged
Conversation
Refs #692 Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #692 (UI kit). main 기준의 독립 PR이며, 다른 PR의 선행 병합이 필요하지 않습니다.
요약
Select 트리거의 기본 id가 문자열
-trigger로 고정되어 있어, 한 페이지에 Select가 여러 개 있거나 Select가 중첩되면 id가 중복됩니다. listbox의aria-labelledby도 같은 id를 참조하므로 자기 트리거를 명확하게 가리키지 못합니다.기본 트리거 id를 listbox와 같은 기준인
${props.id ?? generatedId}-trigger로 초기화합니다. 실제 동작 변경은 초기값 한 표현식뿐이며, 저장소 Prettier 규칙에 따라 호출을 여러 줄로 감쌌습니다. 명시적인SelectTrigger id우선순위는 유지합니다. 회귀 테스트 3개와 components Patch changepack을 추가했습니다.기준 커밋:
78d7c2b2673bdeaa0870bac6a2ec424706986de7(origin/main).동작
id="-trigger"useId()를 바탕으로 서로 다른 트리거 id 생성<Select id="x">id="-trigger"id="x-trigger"aria-labelledby="-trigger"로 중복 id 참조aria-labelledby로 참조<Select id="x"><SelectTrigger id="custom-trigger">custom-trigger사용custom-trigger사용 및 listbox 레이블 연결-triggerselect-trigger, 자식nested-trigger새로 생기는 오류
없음. 의존성, 공개 API, 빌드 오류 종류를 추가하지 않습니다. WASM 빌드와 루트 빌드는 모두 통과했습니다.
남는 한계
bun-test-env-dom렌더 환경에서 DOM id와 ARIA 연결을 확인합니다. 실제 스크린리더 조작 검증은 수행하지 않았습니다.검증
bun test ./packages/components/src/components/Select/__tests__/trigger-id.browser.test.tsx에서 1 pass / 2 fail. id 없는 두 트리거가 모두-trigger여서 실패하고, 루트 id가x인 경우에도 실제 id가-trigger여서 실패했습니다. 명시적 트리거 id 테스트는 통과했습니다.bun test ./packages/components/src/components/Select/__tests__/index.browser.test.tsx --update-snapshots에서 34 pass / 0 fail. 해당 스냅샷 파일만 변경됐고, 다음 6개 줄의 속성 값 외에는 변경이 없습니다.id="-trigger"→id="select-trigger"id="-trigger"→id="select-trigger"id="-trigger"→id="select-trigger"aria-labelledby="-trigger"→aria-labelledby="select-trigger"id="-trigger"→id="nested-trigger"id="-trigger"→id="select-trigger"bun lint1회: 기존 경고 20개와 초기값 줄바꿈 formatting 오류 1개를 확인했습니다. 저장소 밖의 scopedbun run lint:fixhelper로 수정한 TSX 2개만 포맷했습니다. 이후 pre-commit 전체 lint는 0 errors / 20 existing warnings로 통과했습니다. 새 경고는 없습니다.bun test --coverage1회: 6657 pass / 0 fail, 165개 파일, snapshot 89개, assertion 25050개, 273.33초.bun install이후bun.lock의 diff는 비어 있으며 working-file/HEAD blob hash가 모두6f29191a058e5033e5270a13fc0832501f2c3931입니다. lockfile은 커밋하지 않았습니다.