Skip to content

Use the new focusRedirect system rather than overriding event_gainFocus on objects #9209

@LeonarddeR

Description

@LeonarddeR

Is your feature request related to a problem? Please describe.

NVDA uses legacy focus redirection code in several places. For example:

  • NVDAObjects.IAccessible.qt.Container
  • NVDAObjects.IAccessible.qt.Client
  • NVDAObjects.UIA.edge.EdgeHTMLRootContainer

The Edge code looks like this:

	def event_gainFocus(self):
		firstChild=self.firstChild
		if isinstance(firstChild,UIA):
			eventHandler.executeEvent("gainFocus",firstChild)
			return
		return super(EdgeHTMLRootContainer,self).event_gainFocus()

Describe the solution you'd like

NVDAObjects now support the new focusRedirect code. The code above could therefore be shortened and simplified to the following:

	def _get_focusRedirect(self):
		firstChild=self.firstChild
		if isinstance(firstChild,UIA):
			return firstChild
		return None

Describe alternatives you've considered

There is always a possibility to leave this as is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    audience/nvda-devPR or issue is relevant to NVDA / Add-on developersgood first issuegithub features these at https://github.com/nvaccess/nvda/contributep5https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#prioritytriagedHas been triaged, issue is waiting for implementation.z goodForNewDev (archived)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions