Skip to content

fix: keep a control focused after a select closes when its late hand-back runs - #1835

Merged
yansfil merged 4 commits into
mainfrom
fix/flaky-mac-view-area
Oct 29, 2026
Merged

yansfil merged 4 commits into
mainfrom
fix/flaky-mac-view-area

Conversation

@yansfil

@yansfil yansfil commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Closes with-hide/hide-private#127

Summary

  • Settings에서 언어를 고른 직후 글자 크기 slider에 End를 누르는 desktop 테스트 3개가 가끔 실패했습니다(Add the web shell pivot umbrella PRD and S0 spike PRD #127: 17 대신 13).
  • 원인: 닫히는 언어 Select가 키보드를 자기 버튼에 돌려주는 일을 타이머로 미룹니다. 부하가 걸리면 그 타이머가 테스트의 slider.focus() 뒤에 돌아 End가 버튼으로 갑니다.
  • 제품 수정: Select가 닫힌 뒤 다른 컨트롤이 이미 키보드를 가져갔다면, 늦게 도는 반환이 그 focus를 빼앗지 않습니다. 아무것도 가져가지 않았으면 예전처럼 Select 버튼으로 돌아갑니다. 메뉴와 대화상자가 쓰는 같은 보호(useReturnFocus)를 Select도 거칩니다(docs/UI_BEHAVIOR.md: a delayed focus return from any layer leaves a newer control or layer's focus in place).
  • 테스트: 세 테스트는 그 반환이 끝난 상태(언어 버튼에 focus)를 기다린 뒤 키보드를 옮깁니다. 대기 시간, retry, lane은 그대로입니다.

스크린샷 없음: 키보드 focus가 어디로 가는지만 바뀌고 그려지는 화면은 같습니다.

이 묶음(mission-13 flaky2-mac-viewarea)의 10개 이슈 처리, 10-23~10-29 macOS desktop CI 기록 304회 기준:

이슈 테스트 처리
#127 pane-move 글자 크기 이 PR (304회 중 3회 재발)
#157 new-tab ⌘T/⌘W #1650이 고침, 닫음 (마지막 실패 커밋은 #1650 이전)
#177 group-tabs 새 터미널 #1493이 고침, 닫음
#178 new-terminal macOS 서명은 #1493이 고침; 10-28 Windows 서명이 남아 열어 둠
#249 #182 #175 #231 lane drag, owl, area cycle, page note 0회 재발, 고친 커밋 미확인: 원인 후보만 코멘트, 범위 밖
#129 close-policy ⌘W 1회: 후보 앱 main process가 멈춤(teardown도 실패), 범위 밖
#160 agent-logo-peek herdr fixture의 CLI 30 s 타임아웃(다른 spec에도 같은 서명), fixture 작업으로 넘김

의심했던 "data-pane-view 두 개"(#178)는 제품 결함이었습니다: 빈 그룹에서 연 새 터미널이 잠깐 Ungrouped에 놓여 두 pane이 같이 그려졌고, #1493이 core에서 고쳤습니다.

Review

  • 조심해서 볼 파일: web/src/components/ui/select.tsx - 모든 Select가 닫힐 때의 focus 반환 경로입니다. Select root가 열림 상태와 trigger를 context로 내려 주고, content는 useReturnFocus(open, { target: trigger })로 반환합니다. 호출자가 onCloseAutoFocus에서 preventDefault하면(AddProjectDialog의 host 변경) 그쪽이 이깁니다.
  • 조심해서 볼 파일: web/src/components/ui/layer.ts - 모든 layer의 늦은 반환 보호. 반환 대상(trigger)을 감싼 surface가 focus를 가진 것은 "새 컨트롤"로 보지 않습니다. 고른 항목이 사라질 때 Settings 대화상자의 focus trap이 키보드를 대화상자 자체로 옮기는데, 첫 수정은 이것을 새 focus로 읽어 정상 닫힘에서도 trigger로 돌려주지 않았습니다(b72ba42 CI의 세 e2e 실패).
  • 조심해서 볼 파일: desktop/e2e/pane-move.spec.ts, restoration.spec.ts, project-settings.spec.ts - 같은 원인을 가진 세 곳에 같은 대기를 넣었습니다.

Evidence

  • 확인한 것: macOS desktop CI 기록 609개 report(294개 커밋)에서 이슈별 재발을 셈. #127의 3회 모두 End 뒤 13 그대로.
  • 확인한 것: 회귀 테스트 web/src/components/ui/select.test.tsx는 Settings처럼 대화상자 안의 실제 Select로 두 순서를 고정합니다. "고름 -> 새 컨트롤 focus -> 늦은 반환"은 수정 전 Select에서 실패(focus가 Select 버튼으로 감)하고 수정 후 통과합니다. "고름 -> 늦은 반환 -> trigger focus"(정상 닫힘)는 layer.ts 수정 없이 실패(focus가 대화상자에 남음, CI e2e와 같은 증상)하고 수정 후 통과합니다. 테스트는 고정 대기 없이 fake timer로 Radix의 늦은 반환 타이머를 명시 실행하고, 그 전후에 onCloseAutoFocus 호출과 focus를 단언합니다. root는 afterEach가 정리합니다.
  • 확인한 것: verify-web.sh 전체 통과(web test 2251, desktop test 294, lint, typecheck, build).
  • 확인한 것: verify-web.sh desktop lint, desktop typecheck 통과.
  • 확인하지 못한 것: desktop e2e 로컬 실행. 디스크가 5 GiB라 debug 빌드를 하지 않고, 이 PR의 macOS desktop job과 같은 커밋 반복으로 확인합니다.

@yansfil yansfil changed the title test: wait for the language select to hand the keyboard back before moving it fix: keep a control focused after a select closes when its late hand-back runs Oct 29, 2026
@yansfil
yansfil merged commit 4f56d7d into main Oct 29, 2026
28 checks passed
@yansfil
yansfil deleted the fix/flaky-mac-view-area branch October 29, 2026 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant