Skip to content

DotPad: Add multi-button combination gesture support#19565

Merged
seanbudd merged 4 commits intonvaccess:masterfrom
bramd:dotpad-enhanced-input-gestures
Mar 20, 2026
Merged

DotPad: Add multi-button combination gesture support#19565
seanbudd merged 4 commits intonvaccess:masterfrom
bramd:dotpad-enhanced-input-gestures

Conversation

@bramd
Copy link
Copy Markdown
Contributor

@bramd bramd commented Feb 5, 2026

Link to issue number:

None

Summary of the issue:

The DotPad driver only supports single-button input gestures. Users cannot press multiple buttons simultaneously to trigger custom gestures.

Description of user facing changes:

Multi-button input gestures are now supported on DotPad braille displays and can be mapped to NVDA functionality via the Input Gestures dialog. For example, pressing f1 and panLeft simultaneously produces the gesture f1+panLeft.

Description of developer facing changes:

Only internal changes in the DotPad driver. No public API changes.

Description of development approach:

  • Added DP_KeyGroup enum to categorize key groups (FUNCTION, PERKINS, etc.) based on the second byte of notification commands.
  • Added secondByte property to DP_Command for extracting the key group from command values.
  • Implemented key press state tracking across multiple groups (_keysPressed, _keyGroupsReleased).
  • Gestures fire only when all key groups are released, enabling multi-button combinations.
  • Replaced the previous DPKeyGesture with DPInputGesture which builds gesture IDs from all pressed keys.
  • Gesture names use camelCase (e.g., panLeft, panRight, navCenter) converted from the DP_PerkinsKey enum names.
  • Bit order is reversed (LSB to MSB) to match BRLTTY and protocol documentation key numbering.

Testing strategy:

  • Enabled input help and verified:
    • Single button gestures still work and are reported correctly
    • Multi-button presses are reported correctly with consistent key ordering
  • Assigned functions to gestures in Input Gestures dialog, confirmed they work
  • Verified existing panLeft/panRight scroll gestures still function

Known issues with pull request:

  • Normalizing gesture names to camelCase may break existing user gesture mappings to panLeft/panRight if a user has redefined those.
  • Long press support was removed from this PR per review feedback. It will be submitted as a separate PR that adds long press as a framework-wide abstraction for all braille gestures, with a configurable threshold setting.

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.

@bramd bramd force-pushed the dotpad-enhanced-input-gestures branch from 5b5eeac to dd1070d Compare February 5, 2026 10:24
@bramd bramd marked this pull request as ready for review February 5, 2026 10:28
@bramd bramd requested a review from a team as a code owner February 5, 2026 10:28
@bramd bramd requested a review from seanbudd February 5, 2026 10:28
@seanbudd seanbudd added the blocked/needs-product-decision A product decision needs to be made. Decisions about NVDA UX or supported use-cases. label Feb 6, 2026
@seanbudd
Copy link
Copy Markdown
Member

seanbudd commented Feb 6, 2026

Hi @bramd - I just want to confirm with the team whether or not we want long press support in NVDA properly or just for this device. I think we may want to ensure long-presses are available for all gestures and part of our framework

Comment thread source/brailleDisplayDrivers/dotPad/driver.py
Comment thread source/brailleDisplayDrivers/dotPad/driver.py Outdated
Comment thread source/brailleDisplayDrivers/dotPad/driver.py Outdated
@bramd
Copy link
Copy Markdown
Contributor Author

bramd commented Feb 8, 2026

Hi @bramd - I just want to confirm with the team whether or not we want long press support in NVDA properly or just for this device. I think we may want to ensure long-presses are available for all gestures and part of our framework

Good point. If we want to make it more generic I could either extend the PR to implement this or take the logn press support out and separate that in it's own PR. Also, if we make it generic we might want to consider key repeat as well. The current implementation fires one longPress gesture after holding keys, but does not fire gestures on a certain time interval. People might want this for key repeat on braille scrolling gestures for example.

@bramd bramd requested a review from a team as a code owner February 8, 2026 14:12
@bramd bramd requested a review from Qchristensen February 8, 2026 14:12
@bramd bramd marked this pull request as draft February 8, 2026 14:27
@bramd
Copy link
Copy Markdown
Contributor Author

bramd commented Feb 8, 2026

@seanbudd I'll put this back to draft for now until we have a decision on long press gestures.

@seanbudd seanbudd removed blocked blocked/needs-product-decision A product decision needs to be made. Decisions about NVDA UX or supported use-cases. labels Feb 26, 2026
@seanbudd
Copy link
Copy Markdown
Member

@bramd - please refactor out the long press support into a different PR which adds the abstraction for all forms of gestures

@bramd bramd force-pushed the dotpad-enhanced-input-gestures branch from 09a4883 to c97047f Compare March 2, 2026 09:55
@bramd bramd force-pushed the dotpad-enhanced-input-gestures branch from c97047f to 0c4d757 Compare March 2, 2026 10:03
@bramd bramd changed the title DotPad: Add multi-button combinations and long press support DotPad: Add multi-button combination gesture support Mar 2, 2026
@bramd bramd marked this pull request as ready for review March 2, 2026 22:38
@bramd
Copy link
Copy Markdown
Contributor Author

bramd commented Mar 2, 2026

@seanbudd To clarify on the follow up for long press support: I would propose this to be braille specific. It doesn't make sense for keyboard input and touch has it's own specific handling of hover/tap/hold. Was that your intent or where do you see other uses for long press support?

@seanbudd seanbudd assigned seanbudd and unassigned michaelDCurran Mar 2, 2026
@SaschaCowley
Copy link
Copy Markdown
Member

@bramd said:

To clarify on the follow up for long press support: I would propose this to be braille specific. It doesn't make sense for keyboard input

Why doesn't it make sense for keyboard input? I'm not saying we need to add it for keyboard input, but conceptually it makes sense to me, and would allow further flexibility (for instance, NVDA+t could speak the title on press, spell it on double-press, and copy it on long-press).

Copy link
Copy Markdown
Member

@seanbudd seanbudd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bramd

Comment thread source/brailleDisplayDrivers/dotPad/driver.py Outdated
@seanbudd
Copy link
Copy Markdown
Member

seanbudd commented Mar 3, 2026

@bramd - keeping it braille specific for now is fine too. Can you also make multi-button support available for all braille devices?

@seanbudd
Copy link
Copy Markdown
Member

seanbudd commented Mar 3, 2026

Can you also make multi-button support available for all braille devices?

Sorry I'm not sure if this is the case already or if we can make this more generic

@seanbudd seanbudd requested a review from Copilot March 3, 2026 03:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds multi-button combination gesture support for the DotPad braille display driver, enabling NVDA users to bind simultaneous button presses (e.g., f1+panLeft) via the Input Gestures dialog.

Changes:

  • Added key-group categorization (DP_KeyGroup) and command parsing helper (DP_Command.secondByte) for key notifications.
  • Implemented multi-group key press state tracking and a new DPInputGesture that builds combo gesture IDs from all pressed keys.
  • Updated default DotPad pan gesture identifiers and documented the new feature in user-facing change notes.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
user_docs/en/changes.md Documents multi-button gesture support for DotPad displays.
source/brailleDisplayDrivers/dotPad/driver.py Implements key state tracking across notifications and generates combination gesture IDs; updates default gestureMap IDs.
source/brailleDisplayDrivers/dotPad/defs.py Adds DP_KeyGroup enum and DP_Command.secondByte helper used for identifying key groups.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread source/brailleDisplayDrivers/dotPad/driver.py
Comment thread source/brailleDisplayDrivers/dotPad/driver.py Outdated
Comment thread source/brailleDisplayDrivers/dotPad/driver.py
Comment thread source/brailleDisplayDrivers/dotPad/driver.py
@seanbudd seanbudd marked this pull request as draft March 3, 2026 06:23
@seanbudd seanbudd added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label Mar 5, 2026
@bramd
Copy link
Copy Markdown
Contributor Author

bramd commented Mar 19, 2026

Why doesn't it make sense for keyboard input? I'm not saying we need to add it for keyboard input, but conceptually it makes sense to me, and would allow further flexibility (for instance, NVDA+t could speak the title on press, spell it on double-press, and copy it on long-press).

Correct, but currently we trigger a gesture on key down and holding a key would result in key repeat kicking in. For example, if you hold nvda+t for a while, you will get the title copied since the script count increases on every key repeat and the highest count (3) will copy the title. So to handle long presses, we would need to trigger the gesture on key up, which might feel sluggish and is different from how most programs handle keyboard input. It might also interfere with gestures that are useful with key repeat now, such as pressing and holding up/down arrow in a virtual buffer and scrolling through the text rapidly. If we want to explore long press keyboard gestures it might be better to do that in a separate issue since I think there are some design decisions and edge cases to work out if we want to go that route.

@bramd
Copy link
Copy Markdown
Contributor Author

bramd commented Mar 19, 2026

Can you also make multi-button support available for all braille devices?

Sorry I'm not sure if this is the case already or if we can make this more generic

As it is now, every BrailleDisplayDriver has it's own gesture class and the driver constructs that class with the expected input, which often is a list/set of keycodes. This is all fairly device specific and I think needs testing on real hardware if we refactor/change it. I am considering making some re-usable methods for key press/release tracking for long press support, so a braille display driver can start using those to have less code to manage and use the long press concept. I think this should be opt-in though, so we can ask existing braille driver maintainers to implement this and test it on real hardware.

To get back to your original question, multi button combinations are already implemented for the braille display drivers I'm familiar with. For Dot Pad it just had a very simple implementation to make single buttons work on press (not on release).

bramd added 3 commits March 19, 2026 20:29
…ser guide

- Pass copy of _keysPressed to DPInputGesture to prevent .clear() from emptying the gesture keys
- Narrow try/except in DPInputGesture.__init__ so only DP_PerkinsKey lookup is caught
- Update user guide: document available keys (pan + f1-f4), combo gesture support, and update key names to camelCase
@bramd bramd marked this pull request as ready for review March 19, 2026 20:56
Copy link
Copy Markdown
Member

@Qchristensen Qchristensen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reads well, thanks!

@seanbudd seanbudd merged commit 6199acf into nvaccess:master Mar 20, 2026
41 checks passed
@github-actions github-actions Bot added this to the 2026.2 milestone Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants