Skip to content

Clear the braille display on system shutdown - #20646

Merged
seanbudd merged 4 commits into
masterfrom
braille-clear
Aug 13, 2026
Merged

Clear the braille display on system shutdown#20646
seanbudd merged 4 commits into
masterfrom
braille-clear

Conversation

@SaschaCowley

Copy link
Copy Markdown
Member

Link to issue number:

Closes https://github.com/nvaccess/nvda/security/advisories/GHSA-qhjv-3xf4-9c66
Follow-up to #18810

Summary of the issue:

When the machine is shut down or restarted with NVDA running and a braille display connected, the display is not reliably updated before NVDA exits. Depending on timing and braille message settings, whatever was last written to the display can remain on it until the display is refreshed or powered off.

Description of user facing changes:

When shutting down or restarting the computer with NVDA running and a braille display connected, the braille display now either shows "Secure Desktop" or is cleared entirely.

Description of developer facing changes:

None.

Description of development approach:

Two changes:

  1. In braille.brailleHandler.BrailleHandler._onSecureDesktopStateChanged, call self.update() after clearing the main buffer and before switching to the no-braille fallback. The "Secure Desktop" text is presented as an alert, which is not necessarily written to the display. If it isn't, clearing the buffer has no visible effect until the next display update, and by the time this function returns the display has been freed, so later code can no longer refresh it without re-acquiring it.
  2. In our wx app's WM_ENDSESSION handler, disable braille (by registering a braille.extensions.decide_enabled handler that always returns False) and then call braille.handler._clearAll() if a braille handler exists.

In practice step 2 is usually a no-op for me, because the secure desktop state change handler frees the display first, but I don't believe that ordering is guaranteed. To confirm step 2 works on its own, I temporarily removed the session lock and secure desktop state change bindings in BrailleHandler and verified the WM_ENDSESSION path behaves correctly.

Testing strategy:

  • Built a portable copy (./scons dist).
  • Connected a Hims Braille eMotion 40 via USB HID.
  • Shut down the machine with the power button, with "Show messages" set to "Use timeout".
  • Repeated with "Show messages" set to "Disabled".
  • Commented out the registration and unregistration of BrailleHandler's session lock state change and secure desktop state change handlers, rebuilt the dist, ran NVDA and shut down the machine with the power button.
  • In all cases the display was either cleared completely or showed "Secure Desktop".

Known issues with pull request:

When running from source, the display is not updated on shutdown, as we don't appear to receive WM_ENDSESSION. I suspect the Python interpreter consumes it and terminates in that case. I don't think this is something we need to worry about.

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@SaschaCowley
SaschaCowley requested a review from a team as a code owner August 11, 2026 08:17
@SaschaCowley
SaschaCowley requested a review from seanbudd August 11, 2026 08:17
Comment thread user_docs/en/changes.md Outdated
@seanbudd
seanbudd merged commit e830843 into master Aug 13, 2026
13 checks passed
@seanbudd
seanbudd deleted the braille-clear branch August 13, 2026 00:38
@github-actions github-actions Bot added this to the 2026.3 milestone Aug 13, 2026
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.

2 participants