Add undo dialog after factory defaults reset from NVDA menu#19575
Conversation
4337aca to
52be665
Compare
|
@seanbudd I also added a check if backup succeeded before showing the dialog. This will keep the old behavior for some cases, such as running a portable copy from read-only media. I think that is a better experience then showing an undo function which fails silently. |
When resetting configuration to factory defaults via the NVDA menu, a dialog is now shown after the reset with OK and Undo buttons. This prevents accidental loss of settings when users inadvertently press F in the NVDA menu. The triple-press keyboard shortcut (NVDA+ctrl+r) is unaffected as it is intended for recovery scenarios.
* Split the new dialog into a separate file (configManagement.py) * Reformatted changes entry * Contain all Undo dialog related code in a new class
…no permission to write to the config location (running portable from read-only media or locked down profile). In that case, undo would silently fail whici is a bad UX.
… undo Factory reset only modifies config in memory, so undo can simply reload from disk rather than managing backup files. Also adds blockAction decorator to onRevertToDefaultConfigurationCommand and fixes copyright.
9e0e7f3 to
d87665d
Compare
|
@bramd, I am just testing this new feature while translating. I found two small issues / points to discuss:
|
Thanks for testing. No, now you mention it, I can't. I think this is because NVDA is in the process of reloading the config. I could either find a way to ensure it's done after the config is reloaded, not sure if that's easy to do from the top of my head or we could remove the message.
The idea here was to have OK as the default so you could press enter/space to confirm and esc to undo/cancel. If I set the focus to Undo, there is no quick way to activate OK, besides tabbing to the button and activating it. Even if a user presses OK accidentally, they could return to the saved configuration as usual before exiting NVDA, since that's the point that the config gets saved to disk. However, that's probably not well known/easy to find. Do you think having Undo as the default would be the better behavior? What would you expect esc to do? |
|
I could either find a way to ensure it's done after the config is reloaded, not sure if that's easy to do from the top of my
head or we could remove the message.
Try speaking it after the post_configReset extensionPoint notifies.
|
Link to issue number:
Closes #6648
Summary of the issue:
When users accidentally press the F key in the NVDA menu, configuration is reset to factory defaults with no way to recover. Users may not be able to reconfigure NVDA themselves, and restoring settings can be time-consuming.
Description of user facing changes:
When resetting configuration to factory defaults from the NVDA menu, a dialog is now shown after the reset with "OK" and "Undo" buttons:
This prevents accidental loss of settings. The triple-press keyboard shortcut (
NVDA+ctrl+r) is not affected and does not show the dialog, as it is intended for recovery scenarios.Description of developer facing changes:
source/gui/configManagement.pywithFactoryResetUndoDialog(subclass ofMessageDialog) andconfirmRevertToDefaultConfiguration_confirmRevertToDefaultConfigurationonMainFramefor the menu path, delegating toconfigManagementonRevertToDefaultConfigurationCommandremains the keyboard shortcut path (no dialog)@blockAction.when(blockAction.Context.MODAL_DIALOG_OPEN)Description of development approach:
The factory reset (
core.resetConfiguration(factoryDefaults=True)) only modifies configuration in memory — the on-disk config file is not changed. This means:core.resetConfiguration()to reload the saved config from diskNo file-based backup is needed. This approach was chosen based on community feedback in the issue discussion.
Testing strategy:
Known issues with pull request:
None
Code Review Checklist: