nvda
d12c7653 - Convert ui.browseableMessage to wx.html2.WebView (#20251)

Commit
45 days ago
Convert ui.browseableMessage to wx.html2.WebView (#20251) Fixes #18878 Summary of the issue: NVDA shows browseable messages (formatting info, etc.) in a legacy Internet Explorer control, driven by MSHTML's ShowHTMLDialogEx (COM URL monikers + Scripting.Dictionary). Description of user facing changes: Browseable messages now render in a wx.html2.WebView hosted inside NVDA's standard message dialog instead of a standalone IE/MSHTML window. The dialog now has native NVDA buttons (Close, and Copy where requested) rather than HTML buttons. Escape closes the dialog and Alt+C copies. Copying announces a simple "Copied to clipboard" confirmation (spoken and brailled), matching the About dialog; the message text itself is not echoed. Description of developer facing changes: New gui.message.HtmlMessageDialog(MessageDialog) that renders a full HTML document in a WebView. Public API: registerAction(action, handler) to handle nvda-action://<action> URLs triggered from JavaScript, and focusMessage(). The backend is a class attribute _webViewBackend (defaults to WebViewBackendIE) that subclasses can override. MessageDialog gains two protected extension hooks, _createMessageControl() and _wrapMessageControl(), replacing the inline wx.StaticText creation and Wrap call, so the message control can be swapped without branching. ui.browseableMessage rewritten: removed the comtypes / winBindings.mshtml / winBindings.urlmon machinery (ShowHTMLDialogEx, URL monikers, Scripting.Dictionary) and _warnBrowsableMessageComponentFailure. It now fills the message.html template ({{TITLE}} / {{MESSAGE}}) and builds an HtmlMessageDialog, reusing api.copyToClip for copy (matching the About dialog). message.html reduced from ~110 lines of MSHTML-specific JS to a minimal template plus a small keydown handler that routes Escape / Alt+C to nvda-action:// URLs. IAccessible: ShellDocObjectView moves from an imperative event_gainFocus to a declarative _get_focusRedirect (which now also covers the wx WebView case); WxWebView is only applied for OBJID_CLIENT and suppresses the redundant focus report on the outer control. Description of development approach: The wx WebView is hosted in the existing MessageDialog rather than reimplementing dialog chrome, buttons, and fallback handling in HTML. Because the WebView captures keyboard focus and the dialog is shown modeless, keyboard activation (Escape / Alt+C) is bridged from JS to Python via nvda-action:// URLs intercepted in the navigating event; mouse activation uses the native buttons.
Author
Parents
Loading