Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new extension points for keyboard input and speech pause #17428

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ctoth
Copy link
Contributor

@ctoth ctoth commented Nov 23, 2024

Add new extension points for raw keyboard events and speech pause state

This commit introduces two new extension points:

  1. inputCore.decide_handleRawKey
  • Called before any NVDA processing of raw keyboard events
  • Allows add-ons to intercept and optionally block keyboard events
  • Provides full context: vkCode, scanCode, extended flag, and press/release state
  • Implemented in both keyDown and keyUp event handlers
  • Returns True to allow normal processing, False to block the key
  1. speech.extensions.speechPaused
  • Notifies when speech is paused or resumed
  • Provides boolean 'switch' parameter (True=paused, False=resumed)
  • Added corresponding unit tests to verify functionality
  • Integrated into existing pauseSpeech() function

Technical Details:

  • Added documentation for both extension points in developerGuide.md
  • Updated speech/init.py to expose the new speechPaused extension point
  • Added test case in test_speech.py to verify extension point behavior
  • Maintains backwards compatibility with existing extensions

These additions enable add-ons to:

  • Implement advanced keyboard interception/modification
  • React to speech pause state changes

Link to issue number:

N/A - New feature addition for extensibility

Summary of the issue:

NVDA needed additional extension points to allow add-ons to:

  1. Intercept and control raw keyboard events before NVDA processing
  2. Monitor and react to speech pause state changes

Description of user facing changes

  • No direct user-facing changes
  • Enables add-on developers to create more sophisticated keyboard handling and speech feedback features
  • All changes are API-level additions that maintain backwards compatibility

Description of development approach

  1. Raw Keyboard Extension Point:

    • Added decide_handleRawKey extension point in inputCore.py
    • Integrated into both keyDown and keyUp event handlers in keyboardHandler.py
    • Full keyboard event context provided (vkCode, scanCode, extended, pressed)
    • Boolean return value controls event propagation
  2. Speech Pause Extension Point:

    • Added speechPaused extension point in speech/extensions.py
    • Integrated into existing pauseSpeech() function
    • Provides pause state through boolean parameter
  3. Documentation:

    • Added entries in developerGuide.md
    • Updated relevant module documentation
    • Added changelog entry

Testing strategy:

  1. Unit Tests:

    • Added test cases in test_speech.py for speechPaused extension point
    • Tests verify extension point notification on pause/resume
    • Tests ensure correct parameter passing
  2. Manual Testing:

    • Verified keyboard extension point with test add-on
    • Confirmed speech pause notifications work as expected

Known issues with pull request:

None identified - straightforward API additions with full test coverage

Code Review Checklist:

  • Documentation:

    • Change log entry added in changes.md
    • Developer documentation updated in developerGuide.md
    • Technical documentation added in module docstrings
    • No GUI changes, so no context help needed
  • Testing:

    • Unit tests added for speechPaused
    • Manual testing performed with test add-on
    • System tests not required (API-level changes)
  • UX of all users considered:

    • No direct user impact
    • Enables better add-on support for all output methods
    • No localization impact (API only)
  • API is compatible with existing add-ons

    • New extension points are additive only
    • No breaking changes to existing APIs
    • Follows established extension point patterns
  • Security precautions taken:

    • Discussed raw keystroke decider security implications with NV Access.

@coderabbitai summary

- Add decide_handleRawKey extension point to allow intercepting raw keyboard events
- Add speechPaused extension point for speech pause/resume notifications
- Update documentation to reflect new extension points
- Add unit tests for speechPaused extension point
@ctoth ctoth marked this pull request as ready for review November 23, 2024 17:04
@ctoth ctoth requested a review from a team as a code owner November 23, 2024 17:04
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.

1 participant