Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions source/globalCommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -2785,35 +2785,34 @@ def _getNvdaObjWithAnnotationUnderCaret(self) -> Optional[NVDAObject]:
relation' in that range, and we don't yet have a way for the user to select which one to report.
For now, we minimise this risk by only reporting details at the current location.
"""
_isDebugLogCatEnabled = bool(config.conf["debugLog"]["annotations"])
try:
# Common cases use Caret Position: vbuf available or object supports text range
# Eg editable text, or regular web content
# Firefox and Chromium support this even in a button within a role=application.
caret: textInfos.TextInfo = api.getCaretPosition()
except RuntimeError:
log.debugWarning("Unable to get the caret position.", exc_info=True)
return None
caret.expand(textInfos.UNIT_CHARACTER)
objAtStart: NVDAObject = caret.NVDAObjectAtStart
_isDebugLogCatEnabled = bool(config.conf["debugLog"]["annotations"])
if _isDebugLogCatEnabled:
log.debug(f"Trying with nvdaObject : {objAtStart}")

if objAtStart.annotations:
else:
caret.expand(textInfos.UNIT_CHARACTER)
objAtStart: NVDAObject = caret.NVDAObjectAtStart
if _isDebugLogCatEnabled:
log.debug("NVDAObjectAtStart of caret has details")
return objAtStart
elif api.getFocusObject():
log.debug(f"Trying with nvdaObject : {objAtStart}")
if objAtStart.annotations:
if _isDebugLogCatEnabled:
log.debug("NVDAObjectAtStart of caret has details")
return objAtStart

focus: NVDAObject = api.getFocusObject()
if focus:
# If fetching from the caret position fails, try via the focus object
# This case is to support where there is no virtual buffer or text interface and a caret position can
# not be fetched.
# There may still be an object with focus that has details.
# There isn't a known test case for this, however there isn't a known downside to attempt this.
focus = api.getFocusObject()
if _isDebugLogCatEnabled:
log.debug(f"Trying focus object: {focus}")

if objAtStart.annotations:
if focus.annotations:
if _isDebugLogCatEnabled:
log.debug("focus object has details, able to proceed")
return focus
Expand Down
1 change: 1 addition & 0 deletions user_docs/en/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* When moving to an ARIA grid cell in focus mode in web browsers, NVDA no longer reports both the row and column headers even if only the row or only the column changed. (#17750, @jcsteh)
* When an application stops responding, NVDA no longer freezes or floods its log with errors; it stays responsive and drops UIA and MSAA events from the unresponsive application until it recovers. (#16749, @heath-toby)
* Reduced lag on UI Automation text change events, improving the responsiveness of controls such as combo boxes and of File Explorer, by using the cached element class name instead of a live cross-process fetch. (#16749, @heath-toby)
* In Mozilla Firefox, reporting annotation details now works correctly in focus mode on controls which are not editable text. (#20208, @jcsteh)

### Changes for Developers

Expand Down
Loading