Search code examples
accessibilitynsisnsdialogs

Handling keyboard navigation in nsDialogs


I'm using nsDialogs to create a custom page in the installer of my app, where users can decide between standard and portable installation.

For this, I create two radio button controls via NSD_CreateRadioButton so that users can decide between the two installation modes.

After receiving feedback from blind users, I'd like to add the possibility to navigate via keyboard between those two radio buttons. So far, pressing the Tab key navigates directly to the next button in the lower navigation bar and not to the . Arrow up / Arrow down have no effect.

How can I add this possibility for keyboard navigation using nsDialogs?


Solution

  • If you use the ${NSD_Create*} macros in nsDialogs.nsh then the WS_TABSTOP style will be set for button controls and you can Tab to them. However, the tab order is: the bottom buttons before the buttons in your dialog.

    Assign a access key to allow a user to access a control directly. You do that by adding a ampersand (&) to the text label before a specific character:

    ${NSD_CreateRadioButton} 0 13u 100% 15u "Click &Me" ; Activate by pressing Alt+M
    Pop $0
    ${NSD_CreateRadioButton} 0 30u 100% 15u "&Or Me"
    Pop $0
    

    The arrow keys should also work once one of the radio buttons have focus. The WS_GROUP style also plays a role in keyboard navigation if you have multiple groups of unrelated radio buttons.