Skip to content

Exception when trying to interact with a text box in Firefox that isn't focused #12114

@jcsteh

Description

@jcsteh

Steps to reproduce:

  1. Open this URL in Firefox:
    data:text/html,<input><button>hi</button>
  2. Tab until the button is focused.
  3. Move to the previous navigator object (desktop NVDA+numpad4, laptop NVDA+shift+leftArrow)

Actual behavior:

No speech and this exception:

ERROR - scriptHandler.executeScript (09:05:07.874) - MainThread (18464):
error executing script: <bound method GlobalCommands.script_navigatorObject_previous of <globalCommands.GlobalCommands object at 0x03E03B50>> with gesture 'NVDA+numpad 4'
Traceback (most recent call last):
  File "scriptHandler.pyc", line 208, in executeScript
  File "globalCommands.pyc", line 1177, in script_navigatorObject_previous
  File "speech\__init__.pyc", line 478, in speakObject
  File "speech\__init__.pyc", line 528, in getObjectSpeech
  File "documentBase.pyc", line 24, in makeTextInfo
  File "NVDAObjects\IAccessible\ia2TextMozilla.pyc", line 121, in __init__
  File "NVDAObjects\IAccessible\ia2TextMozilla.pyc", line 173, in _getSelectionBase
  File "NVDAObjects\IAccessible\ia2TextMozilla.pyc", line 183, in _makeRawTextInfo
  File "textInfos\offsets.pyc", line 472, in __init__
  File "NVDAObjects\IAccessible\__init__.pyc", line 202, in _getSelectionOffsets
  File "NVDAObjects\IAccessible\__init__.pyc", line 188, in _getCaretOffset
RuntimeError: no active caret in this object

Expected behavior:

NVDA should say: "edit blank"

System configuration

NVDA installed/portable/running from source:

Installed

NVDA version:

alpha-21810,db664bef

Windows version:

Win 10 Version 20H2 (OS Build 19042.782)

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

Firefox Nightly 88.0a1 (2021-03-03) (64-bit)

More Info

This regression was introduced in 65c5b59. I think the issue is that in Firefox, when an object isn't focused, it has no caret, so the TextInfo throws a RuntimeError. We previously caught all exceptions when trying to get the selection. Now, we only catch NotImplementedError.

This doesn't happen in Chromium because Chromium seems to maintain a caret (at least for a11y) even when the object isn't focused.

CC @michaelDCurran.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions