현상
On Firefox with Windows 10 and Korean IME, specific key combination sequences during IME composition can cause the contenteditable editor to crash unexpectedly.
재현 예시
- Focus on contenteditable element.
- Enable Korean IME (Microsoft IME on Windows).
- Type ‘ㅀ’ (press ‘f’, then ‘g’ on QWERTY keyboard).
- Press Enter to confirm composition.
- Press Ctrl+Shift+Home.
- ❌ Editor crashes and becomes unresponsive.
- User must reload the page.
관찰된 동작
- Specific key combination crash: Ctrl+Shift+Home triggers editor crash
- JavaScript execution stops: Browser completely halts when crash occurs
- Page unresponsive: No user interaction possible until reload
- Firefox specific: Issue only affects Firefox
예상 동작
- Editor should handle key combinations without crashing
- IME composition should complete or be interrupted gracefully
- JavaScript execution should continue normally
참고사항 및 가능한 해결 방향
- Block dangerous combinations during IME: Prevent Ctrl+Shift+Home during composition
- Try-catch error handling: Wrap critical operations in try-catch blocks
- Error reporting: Log errors and inform user gracefully
- Graceful recovery: Implement fallback mechanisms when errors occur
코드 예시
const editor = document.querySelector('div[contenteditable]');
let isComposing = false;
// Track IME state
editor.addEventListener('compositionstart', () => {
isComposing = true;
});
editor.addEventListener('compositionend', () => {
isComposing = false;
});
// Block dangerous key combination
editor.addEventListener('keydown', (e) => {
if (isComposing && e.ctrlKey && e.shiftKey && e.key === 'Home') {
e.preventDefault();
console.warn('Dangerous key combination blocked during IME composition:', e.key);
}
});
// Prevent crash with error handling
editor.addEventListener('input', (e) => {
try {
// Input handling logic
} catch (error) {
console.error('Input error:', error);
// Graceful recovery
alert('An error occurred during input. Please reload the page.');
}
});