Skip to content

Set focus on existing dialog rather than raise an error if the dialog when launching a dialog which is already open#12800

Merged
seanbudd merged 2 commits into
masterfrom
fix-5383
Sep 2, 2021
Merged

Set focus on existing dialog rather than raise an error if the dialog when launching a dialog which is already open#12800
seanbudd merged 2 commits into
masterfrom
fix-5383

Conversation

@seanbudd

@seanbudd seanbudd commented Sep 2, 2021

Copy link
Copy Markdown
Member

Link to issue number:

Fixes #5383

Summary of the issue:

NVDA raises an error when launching a dialog, when the dialog is already open. This is unfriendly to the user, and should instead focus the open dialog.

Example:

  1. Press NVDA+n to open the NVDA menu
  2. Launch the settings dialog by pressing p then s
  3. Change a setting, so that you can confirm a new instance isn't created
  4. Minimise the settings dialog window
  5. Press NVDA+n to open the NVDA menu
  6. Launch the settings dialog by pressing p then s
  7. An error message is raised

Description of how this pull request fixes the issue:

Set focus on existing dialog rather than raise an error if the dialog when launching a dialog which is already open.

Testing strategy:

Manual testing:

  1. Press NVDA+n to open the NVDA menu
  2. Launch the settings dialog by pressing p then s
  3. Change a setting, so that you can confirm a new instance isn't created
  4. Minimise the settings dialog window
  5. Press NVDA+n to open the NVDA menu
  6. Launch the settings dialog by pressing p then s
  7. Confirm the same settings dialog from before is now focused, a new instance was not created, and the error message dialog isn't opened.

System testing

System testing could be added here, but for such a specific feature it seems unworthy, the reviewer may disagree.

Known issues with pull request:

Change log entries:

Changes

- When opening a settings dialog which is already open, NVDA sets focus on the existing dialog rather than raise an error. (#5383)

Code Review Checklist:

  • Pull Request description is up to date.
  • Unit tests.
  • System (end to end) tests.
  • Manual testing.
  • User Documentation.
  • Change log entry.
  • Context sensitive help for GUI changes.
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers

@seanbudd seanbudd merged commit d624b5a into master Sep 2, 2021
@seanbudd seanbudd deleted the fix-5383 branch September 2, 2021 07:50
@nvaccessAuto nvaccessAuto added this to the 2021.3 milestone Sep 2, 2021
@cary-rowen

Copy link
Copy Markdown
Contributor

I tested this PR and the current experience is good.

Thanks.

@CyrilleB79

Copy link
Copy Markdown
Contributor

Hello
I have tested this PR. Even if the overall experience has improved, there are still some issues remaining. Here is the detailed results of my tests for various dialogs:

Test successful

  • Punctuation and symbols
  • Input gesture
  • Setting dialogs of add-ons. Example tested: Access8Math general settings.

Test almost successful

Test 1

STR:

  • NVDA+ctrl+G
  • focus desktop
  • NVDA+ctrl+K
    Expected: keyboard settings focused
    Actual: general settings focused

Test 2

STR:

  • Open default dictionary
  • focus desktop
  • Open voice dictionary
    Expected: Voice dictionary focused
    Actual: default dictionary focused

Test with error

STR:

  • Open braille settings
  • press "Change button to choose braille display
  • focus desktop
  • press NVDA+ctrl+V to open voice settings
    Error:
IO - external:inputCore.executeGesture (15:08:06.965) - winInputHook (10856):
Input: kb(desktop):NVDA+control+v
DEBUG - external:gui.settingsDialogs.__new__ (15:08:07.004) - MainThread (11064):
Creating new settings dialog (multiInstanceAllowed:False). State of _instances {<gui.settingsDialogs.NVDASettingsDialog object at 0x1255FD50>: <DialogState.DESTROYED: 1>, <gui.settingsDialogs.BrailleDisplaySelectionDialog object at 0x1260B760>: <DialogState.CREATED: 0>}
ERROR - external:gui.settingsDialogs.__new__ (15:08:07.004) - MainThread (11064):
Opening new settings dialog while instance still exists: <gui.settingsDialogs.NVDASettingsDialog object at 0x1255FD50>

Some dialogs are not re-focused when opened a second time:

  • config profile dialog
  • Add-on manager

NVDA+N not working while these dialogs are opened

  • Welcom dialog
  • About dialog

Note:

Most of the mentioned issues (if not all) were already present in NVDA. Thus this PR should not be reverted. But while fixing "Already opened dialog" problem, I think that they should be considered.

@seanbudd

seanbudd commented Sep 2, 2021

Copy link
Copy Markdown
Member Author

Hi @CyrilleB79, thank you for testing this.
Would you be able to create issues for these if they do not already exist?
I am going to look into the "Test with Error" soon, as it also creates an additional preferences dialog, which is dangerous behaviour (and also happens with 2021.1).

All tests except the "Test almost successful" tests are existing behaviour (eg in 2021.1). These cases would throw the error message normally, and need to be improved as well as this will lead to confusion. Perhaps this PR should be reverted because of this.

@cary-rowen

Copy link
Copy Markdown
Contributor

@CyrilleB79
Hello, I did not receive an error when I executed the following STR:
Test with error
STR:
• Open braille settings
• press "Change button to choose braille display
• focus desktop
• press NVDA+ctrl+V to open voice settings

@feerrenrut

Copy link
Copy Markdown
Contributor

@seanbudd is there a regression here? If so this may need to be reverted (before 2021.3) until these issues are resolved.

@seanbudd

seanbudd commented Sep 9, 2021

Copy link
Copy Markdown
Member Author

@seanbudd is there a regression here? If so this may need to be reverted (before 2021.3) until these issues are resolved.

@feerrenrut
See my earlier comment:

All tests except the "Test almost successful" tests are existing behaviour (eg in 2021.1). These cases would throw the error message normally, and need to be improved as well as this will lead to confusion. Perhaps this PR should be reverted because of this.

There is no regression - but there is a change of behaviour. Instead of throwing an error message when a settings dialog is already opened, the dialog is focused, but not necessarily the target pane (eg Keyboard settings). Same for dictionary dialogs.

The other bugs @CyrilleB79 raised can be reproduced with 2021.1

@feerrenrut

Copy link
Copy Markdown
Contributor

Thanks for the summary @seanbudd

seanbudd added a commit that referenced this pull request Oct 22, 2021
…naries are of different types. (#12967)

Fix-up of #12800.
Described in #12800 (comment), paragraph "Test almost successful", "Test 2".

Summary of the issue:
Since the merge of #12800, trying to re-open an already opened dialog allows to focus it rather than issuing an error as done previously. However, in the case of dictionaries, if you try to open the voice dictionary while the default is already open will lead to focus the default dictionary rather than opening the voice dictionary dialog;

Description of how this pull request fixes the issue:
Since the check of an existing opened dialog is made on the class of the dialog, I have sub-classed DictionaryDialog for the three types of dictionaries to make them distinct one from another.

Co-authored-by: Sean Budd <sean@nvaccess.org>
seanbudd pushed a commit that referenced this pull request Jan 25, 2022
Link to issue number:
Follow-up of #12967

Summary of the issue:
Since the merge of #12800, trying to re-open an already opened dialog allows to focus it rather than issuing an error message box. The dialog is refocused according to its class, i.e. trying to open a dialog of the same class rather refocus the first already opened dialog of the same class.

But with #12800, it was not possible to open 2 dictionaries of different type (e.g. speech and default). This was fixed with #12967 by subclassing DictionaryDialog.
However, addons which directly use DictionaryDialog will still have the issue of opening 2 dictionaries at once i.e. #5383.

Description of how this pull request fixes the issue:
force DictionaryDialog to be subclassed by making the initializer and abstract method
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.

focus existing NVDA Settings dialog if the same dialog is attempted to be opened again instead of presenting Error dialog

6 participants