nvaccess / nvda

NVDA, the free and open source Screen Reader for Microsoft Windows
https://www.nvaccess.org/
Other
2.12k stars 638 forks source link

Events that expect the current object to be the focus object doesn't work properly when the object gained focus do to a focusRedirect property of another object #17411

Closed Emil-18 closed 6 days ago

Emil-18 commented 1 week ago

Steps to reproduce:

Create a new global plugin in the scratchpad directory and copy the following code in to it.

import copy
import globalPluginHandler
import NVDAObjects
class FocusRedirectTest(NVDAObjects.NVDAObject):
    def _get_focusRedirect(self):
        return(copy.copy(self))

class GlobalPlugin(globalPluginHandler.GlobalPlugin):
    def chooseNVDAObjectOverlayClasses(self, obj, clsList):
        clsList.insert(0, FocusRedirectTest)

Make sure that "Enable loading custom code from Developer Scratchpad directory" is turned on, and then restart NVDA to make the add-on take effect. Then go to for example the desktop and press control + space to select or unselect a list item

Actual behavior:

speech and braille reports nothing. I think this happens because api.getFocusObject() isn't the object that fired the event, e.g obj is api.getFocusObject() returns False, but obj == api.getFocusObject() returns True. pr #16473 was supposed to fix this, but the excel issue detailed in that is still present, and caused by the same problem.

Expected behavior:

The changed state should be reported as normal.

NVDA logs, crash dumps and other attachments:

System configuration

NVDA installed/portable/running from source:

Installed

NVDA version:

2024.4.1

Windows version:

Windows 11

Name and version of other software in use when reproducing the issue:

n/a

Other information about your system:

Other questions

Does the issue still occur after restarting your computer?

Yes

Have you tried any other versions of NVDA? If so, please report their behaviors.

No

If NVDA add-ons are disabled, is your problem still occurring?

Yes

Does the issue still occur after you run the COM Registration Fixing Tool in NVDA's tools menu?

Yes

seanbudd commented 6 days ago

It appears that you are reporting a bug with excel as reference to https://github.com/nvaccess/nvda/pull/16473#issuecomment-2417594962

Can you please open a standard bug report not a code analysis? This seems to be an X/Y problem, where we have jumped to discussing Y as a solution without properly understanding/documenting X, the underlying bug. Our understanding is the current code is working as intended.