Package: firefox-esr
Version: 52.8.1esr-1~deb8u1
Severity: normal
Tags: upstream a11y patch
Owner: [email protected]
User: [email protected]
Usertags: hypra
Forwarded: https://bugzilla.mozilla.org/show_bug.cgi?id=1573166
Hello,
For a11y bug tracking in Debian, here is an upstream bug report.
> I have attached a test script to see the behavior under Linux: when the caret
> is put at the end of a line, HyperTextAccessible::Charbounds() returns a
> (0,0,0,0) rect. This is the same kind of issue as Bug 1319273: since there is
> no character here, firefox returns an empty box.
>
> When the line is non-empty, a workaround for a screen magnifier is to take
> the bounds of the last character of the line. But when the line is empty,
> there is really no character to get the bounds of.
>
> In such a case, it would be useful to still return the rect of the caret
> itself, even if with zero width (this is what gtk does for instance), so that
> the screen magnifier can show users which empty line they are going through.
Samuel
#!/usr/bin/python
import pyatspi
import sys
def magnifyAccessible(event, obj=None, extents=None):
if event.source and event.source.getRole() == pyatspi.ROLE_TERMINAL: # protection against parasite events from terminals
return
if event.type.startswith("object:state-changed") and not event.detail1:
# This object just became unselected or unfocused, and we're not
# big on nostalgia.
return
obj = obj or event.source
x, y, width, height = -1,-1,-1,-1
if event and event.type.startswith("object:text-caret-moved"):
try:
text = obj.queryText()
if text and (text.caretOffset >= 0):
offset = text.caretOffset
if offset == text.characterCount:
offset -= 1
if (offset == -1):
offset = 0
[x, y, width, height] = text.getCharacterExtents(offset, 0)
except:
pass
print "position: %i,%i size %i:%s" %(x, y, width, height)
def startTracking():
pyatspi.Registry.registerEventListener(magnifyAccessible, "object:text-caret-moved")
def stopTracking():
pyatspi.Registry.deregisterEventListener(magnifyAccessible, "object:text-caret-moved")
def main():
startTracking()
pyatspi.Registry.start()
return 0
if __name__ == "__main__":
sys.exit(main())