케이스 ce-0149-selection-range-invalid-after-insert-ko · 시나리오 scenario-selection-restoration

콘텐츠 삽입 후 선택 범위가 무효화됨

OS: Windows 11 기기: Desktop or Laptop Any 브라우저: Firefox 120.0 키보드: US 초안
selectionrangeinsertfirefox

현상

Firefox에서 contenteditable 요소에 프로그래밍 방식으로 콘텐츠(텍스트, 요소)를 삽입할 때 선택 범위가 무효화됩니다. 커서 위치가 손실되고 복원할 수 없습니다.

재현 예시

  1. 일부 텍스트를 선택합니다
  2. 선택 위치에 프로그래밍 방식으로 콘텐츠를 삽입합니다
  3. 선택 상태를 확인합니다

관찰된 동작

  • 선택 범위가 무효화됩니다
  • 커서 위치가 손실됩니다
  • 올바른 위치에서 편집을 계속할 수 없습니다
  • 선택을 복원할 수 없습니다

예상 동작

  • 삽입 후 선택이 유효하게 유지되어야 합니다
  • 커서가 삽입된 콘텐츠 뒤에 배치되어야 합니다
  • 사용자가 편집을 계속할 수 있어야 합니다
  • 선택이 올바르게 복원되어야 합니다

브라우저 비교

  • Chrome/Edge: 선택이 일반적으로 유효하게 유지됨
  • Firefox: 선택이 무효화됨 (이 케이스)
  • Safari: 선택 복원이 가장 불안정함

참고 및 해결 방법 가능한 방향

  • 삽입 전 선택 저장
  • 삽입 후 선택 복원
  • 유효한 선택을 유지하기 위해 Range API 사용
  • 무효한 선택을 우아하게 처리

이 시나리오의 변형

케이스 OS 브라우저 상태
ce-0110-selection-lost-after-dom-update-ko Windows 11 Chrome 120.0 초안
ce-0130-selection-invalid-after-wrap-ko Windows 11 Firefox 120.0 초안
ce-0138-selection-collapse-on-click-ko macOS 14.0 Safari 17.0 초안
ce-0149-selection-range-invalid-after-insert-ko Windows 11 Firefox 120.0 초안
ce-0172-selection-invalid-after-replace-ko macOS 14.0 Safari 17.0 초안

Playground for this case

Use the reported environment as a reference and record what happens in your environment while interacting with the editable area.

Reported environment
OS: Windows 11
Device: Desktop or Laptop Any
Browser: Firefox 120.0
Keyboard: US
Your environment
Sample HTML:
Event log
Use this log together with the case description when filing or updating an issue.
0 events
Interact with the editable area to see events here.