Skip to content

Commit

Permalink
Remove Mozilla specific setFocus implementation which waits for a foc…
Browse files Browse the repository at this point in the history
…us event before returning. (#10584)

This was added in #8678 to mitigate focus "rubber-banding" and spurious switching to focus mode when moving fast in browse mode.
However, this degrades performance.
Removing this code, this no longer seems to be a problem.
It's likely that changes in Firefox, NVDA or both mitigated this.
The changes to Firefox to avoid extraneous tree re-creation are a likely candidate.
  • Loading branch information
jcsteh authored and michaelDCurran committed Dec 9, 2019
1 parent cb0beda commit f3ac180
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions source/NVDAObjects/IAccessible/mozilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,39 +17,11 @@
import textInfos.offsets
from NVDAObjects.behaviors import RowWithFakeNavigation
from virtualBuffers import VirtualBuffer
import api
from . import IA2TextTextInfo
from . import ia2Web

class Mozilla(ia2Web.Ia2Web):

def _getPhysicalFocus(self):
try:
paccParent=self.IAccessibleObject.accParent
except COMError:
paccParent=None
if not paccParent:
return
try:
paccFocus=paccParent.accFocus
except COMError:
paccFocus=None
if not paccFocus:
return
return IAccessible(IAccessibleObject=IAccessibleHandler.normalizeIAccessible(paccFocus),IAccessibleChildID=0)

def setFocus(self):
oldFocus=self._getPhysicalFocus()
super(Mozilla,self).setFocus()
# Although all versions of Firefox block inSetFocus or in accFocus until the physical focus has moved,
# Firefox 57 and above return before they fire a focus winEvent communicating the focus change to ATs.
# Therefore, If the call to setFocus did change the physical focus,
# Wait for a focus event to be queued to NVDA before returning.
newFocus=self._getPhysicalFocus()
if newFocus and newFocus!=oldFocus:
while not eventHandler.isPendingEvents("gainFocus"):
api.processPendingEvents(processEventQueue=False)

def _get_parent(self):
#Special code to support Mozilla node_child_of relation (for comboboxes)
res=IAccessibleHandler.accNavigate(self.IAccessibleObject,self.IAccessibleChildID,IAccessibleHandler.NAVRELATION_NODE_CHILD_OF)
Expand Down

0 comments on commit f3ac180

Please sign in to comment.