feat: prevent UIA COM freezes and suppress braille events for stability#7
Merged
VIPPotato merged 1 commit intoVIPPotato:masterfrom Feb 14, 2026
Merged
Conversation
- Add KakaoUIABase overlay that disables _prefetchUIACacheForPropertyIDs for all KakaoTalk UIA objects, preventing buildUpdatedCache() from blocking the NVDA main thread for 8-22 seconds - Add KakaoBrailleSuppressed overlay for context menu objects (EVA_Menu) that skips braille.handler.handleGainFocus() to avoid querying 15+ UIA properties via COM during menu display - Add KakaoTalkMessageEdit overlay for message input field (RICHEDIT50W) that suppresses braille and IAccessible events causing Korean IME character composition breakage - Add event_inputComposition handler to suppress Korean IME composition events that trigger focus instability - Change isGoodUIAWindow from unconditional True to a whitelist approach, preventing EVA_Menu from being forced into UIA mode - Add COMError try-except guards in event_UIA_elementSelected, _get_states, and _get_name to prevent cascading COM failures Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
This PR addresses two critical issues that occur when a braille display is connected to NVDA while using KakaoTalk:
Issue 1: NVDA freezes (Watchdog triggered) when opening context menus
When a braille display is connected, pressing the popup key (Shift+F10 or Applications key) on a message in the chat room list or in the message list within a conversation causes NVDA to freeze for 8-22 seconds, triggering the Watchdog recovery mechanism.
Root cause: NVDA's
_prefetchUIACacheForPropertyIDscallsUIAElement.buildUpdatedCache(), a synchronous cross-process COM call. When KakaoTalk's UI thread is busy handling the context menu modal loop, this call blocks the NVDA main thread until the COM timeout expires. Additionally,braille.handler.handleGainFocus()queries 15+ UIA properties via COM for the braille display, compounding the blocking.Fix:
KakaoUIABase: Overrides_prefetchUIACacheForPropertyIDsas a no-op for all KakaoTalk UIA objects. Individual property accesses fall back togetCurrentPropertyValueEx(), which uses per-property timeouts and is far less likely to cause a total freeze.KakaoBrailleSuppressed: Skipsbraille.handler.handleGainFocus()and returns emptygetBrailleRegions()for allEVA_Menuobjects, preventing braille handler from triggering additional UIA COM queries.isGoodUIAWindow: Changed from unconditionalreturn Trueto a whitelist approach. OnlyEVA_VH_ListControl_Dblclk(the main list control) is forced to use UIA. Other windows (includingEVA_Menu) fall back to NVDA's core decision logic, which typically selects IAccessible for standard Win32 menus.event_UIA_elementSelected,_get_states, and_get_nameto prevent cascading COM failures.Trade-off: Context menu items will not be displayed on the braille display. Speech output for menu items is fully preserved. This is a necessary compromise to prevent the severe freezing issue.
Issue 2: Character composition breakage during message input
When a braille display is connected and the user types in the KakaoTalk message input field, Korean IME character composition breaks — characters appear in wrong positions or certain characters fail to input entirely.
Root cause: Korean IME's
compositionUpdate()queuesvalueChangeandcaretevents on every keystroke. The default NVDA handlers for these events callbraille.handler.handleUpdate()andbraille.handler.handleCaretMove(), which query object properties and disrupt the IAccessible text state, causing focus to jump and character composition to break.Fix:
KakaoTalkMessageEdit: An aggressive overlay for the message input field (RICHEDIT50W, controlID 1006) that:getBrailleRegions,event_braille*,shouldAcceptEvent)event_valueChangeandevent_caretto skip braille handler calls while preserving speech outputevent_inputComposition: Suppresses IME composition events for Korean locale in the message input field to prevent additional focus instability.Class hierarchy
Test plan
🤖 Generated with Claude Code