Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

processFocusWinEvent: force focus-event after a reorder-event was made #2132

Closed
nvaccessAuto opened this issue Feb 27, 2012 · 4 comments
Closed

Comments

@nvaccessAuto
Copy link

Reported by adrianw on 2012-02-27 13:24
Hello.

There is a problem with "processFocusWinEvent()" in IAccessibleHandler.py.

The signature looks like this:
"def processFocusWinEvent(window,objectID,childID,force=False)"

With "force=False" processFocusWinEvent() ignores a second EVENT_OBJECT_FOCUS if the current focused
element has the same childID as the new element even when a EVENT_OBJECT_REORDER was triggered before. So the new focused element never gets read-out by nvda.

In my application, after some user-input, my object-model changes significantly and all the visible elements getting reordered and another element gets the focus. Sometimes different elements got the same childID and a EVENT_OBJECT_FOCUS gets ignored by NVDA (NVDA thinks it's the same element, but that's not the case).

When i edit the nvda-source-code and set "force=True" in processFocusWinEvent everything works fine. The new focused element gets read-out by nvda.

Is it possible to queue the second focus-event when a previous EVENT_OBJECT_REORDER has been made?
IMHO, after a REORDER the first focused element isn't valid any more and nvda should
accept a second EVENT_OBJECT_FOCUS.

To solve this i'd like to suggest:

  • set force=True in processFocusWinEvent() (yes, i know it's not very clever) OR
  • invalidate lastQueuedFocusObject after an EVENT_OBJECT_REORDER was made

Thanks for a great tool!!

Adrian

@nvaccessAuto
Copy link
Author

Comment 2 by jteh on 2012-02-28 01:36
The point of the queuing logic in IAccessibleHandler is to eliminate duplicate/redundant/invalid events. Thus, setting force=True by default is not an option. Having said that, an event should only be eliminated if its target is invalid or it is detected as a duplicate event. I don't understand why this is happening for your application, as events with a child ID greater than 0 are not considered to be duplicates (see NVDAObjects.IAccessible.IAccessible.isDuplicateWinEvent).

Are your children simple elements (i.e. child IDs with no IAccessible object of their own)? Can you provide the log output from pressing NVDA+f1 on a focused child?

It would also be good to see a log of raw focus events. You can get this using AccProbe.

@nvaccessAuto
Copy link
Author

Comment 3 by adrianw on 2012-02-28 14:32
Thanks for your reply.

Q: Are your children simple elements (i.e. child IDs with no IAccessible object of their own)?
A: The children are complex elements and providing their own native IAccessible implementation.
Their parent returns a pointer to an IAccessible (one for each child) when windows is querying "Get_accChild".

Q: Can you provide the log output from pressing NVDA+f1 on a focused child?
A: INFO - globalCommands.GlobalCommands.script_navigatorObject_devInfo (09:16:06):
Developer info for navigator object:
name: u'FIELD1'
role: ROLE_TABLECELL
states: STATE_FOCUSED, STATE_SELECTED
Python object: <NVDAObjects.IAccessible.IAccessible object at 0x06599D70>
Python class mro: (<class 'NVDAObjects.IAccessible.IAccessible'>, <class 'NVDAObjects.window.Window'>, <class 'NVDAObjects.NVDAObject'>, <class 'baseObject.ScriptableObject'>, <class 'baseObject.AutoPropertyObject'>, <type 'object'>)
description: None
location: (571, 584, 112, 18)
value: u'XYZXYZXYZ'
appModule: <'appModuleHandler' (appName u'msaatest', process ID 2004) at address 6645c50>
TextInfo: <class 'NVDAObjects.NVDAObjectTextInfo'>
windowHandle: 591224
windowClassName: u'CustomControlAcc'
windowControlID: 591224
windowStyle: 1442906112
windowThreadID: 4060
windowText: u''
IAccessibleObject: <POINTER(IAccessible) ptr=0x5c1d30 at 659f260>
IAccessibleChildID: 0
IAccessible event parameters: windowHandle=591224, objectID=-4, childID=4
IAccessible accRole: ROLE_SYSTEM_CELL
IAccessible accState: STATE_SYSTEM_SELECTED, STATE_SYSTEM_FOCUSED, STATE_SYSTEM_VALID (6)

Q: It would also be good to see a log of raw focus events.
A: AccProbe doesn't run on my System. But AccEvent from MS does:
...
OBJ_FOCUS Name="CustomControlAcc" Role=table State=focusable, multiselectable

OBJ_REORDER Name="CustomControlAcc" Role=table State=focusable, multiselectable
OBJ_FOCUS Name="FIELD1" Role=cell State=focused, selected

OBJ_REORDER Name="CustomControlAcc" Role=table State=focusable, multiselectable
OBJ_FOCUS Name="FIELD1" Role=cell State=focused, selected
...

These events are exactly what i've implemented so far with NotifyWinEvent after a user have entered some input:
  <process user input>
  NotifyWinEvent(EVENT_OBJECT_REORDER, Handle, OBJID_CLIENT, CHILDID_SELF);
  NotifyWinEvent(EVENT_OBJECT_FOCUS, Handle, OBJID_CLIENT, cellidx);
  <wait for user input>

And NVDA doesn't read-out the "new" focused child.

Thanks!

Adrian

@bhavyashah
Copy link

@jcsteh Since the original author of this ticket, although now out-of-reach, did respond to your questions in #2132 (comment), could you please provide a follow-up comment?

@jcsteh
Copy link
Contributor

jcsteh commented Aug 8, 2017

I haven't dug into this too deeply, but it looks like the no duplicate rule for child id > 0 is specific to simple children; i.e. IAccessibleChildID > 0, not event_childID > 0. In this case, these are full IAccessibles, but with a positive child id. We might be able to test event_childID > 0 instead... or perhaps we could somehow use the reorder event as was originally suggested.

Regardless, we don't have any way to contact the reporter and thus nothing to work with. Closing, but we can reopen if this becomes relevant again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants