Closed Bug 452161 Opened 16 years ago Closed 16 years ago

pyatspi insertText doesn't work in empty textboxes

Categories

(Core :: Disability Access APIs, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: tacone, Assigned: surkov)

References

Details

Attachments

(1 file, 1 obsolete file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008072820 Firefox/3.0.1
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008072820 Firefox/3.0.1

Hello all, I've come to a strange behaviour with Firefox (3.0.1) and
pyatspi. Atspi's insertText() works normally on textareas, but seems
to only work on textboxes (<input type="text" />)  when they're not
empty.

Can anyone confirm this behaviour and suggest a workaround ?

Reproducible: Always

Steps to Reproduce:
1. find a webpage with a texbox (google, yahoo or better more simpler
non-javascript-enabled websites)
2. open Accerciser and inspect the textbox (focus the textbox in the
browser and click ctrl+alt+a)
3. make sure the textbox doesn't contain text. if it does, delete the text at hand.
4. in the accerciser control type: acc.queryEditableText().insertText(0,'xxx',3)
Actual Results:  
nothing.

Expected Results:  
textbox gets populated with 'xxx'

write just one letter in the textbox and everything will work just as expected.
Component: Disability Access → Disability Access APIs
Product: Firefox → Core
QA Contact: disability.access → accessibility-apis
Version: unspecified → Trunk
Hi! Do you get any failure code back?
Marco: insertText() returns True as it always does. No failures of any kind, it just doesn't work.
Confirmed on Windows using AccProbe as well.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Linux → All
the problem we can't set caret position in empty textbox because HypertextOffsetsToDOMRange inSetSelectionBounds() fails because empty textbox hasn't any accessible children.

the structure of html:input is:

html:input
  html:div
    html:br
Alex, don't we create accessibles for <br>? I thought we did.
We don't create an accessible for the ghost <br> that exists merely because the editor implementation would be confused without *something* in an empty textbox.
(In reply to comment #6)
> We don't create an accessible for the ghost <br> that exists merely because the
> editor implementation would be confused without *something* in an empty
> textbox.
> 

it seems we are too, what if we will create accessible for this html:br?
Some of out methods of nsIAccessibleText will fail for empty textboxes for valid 0 offsets:

ScrollSubstringTo, ScrollSubstringToPoint - use HypertextOffsetsToDOMRange
GetText - uses GetPosAndText

but I think they shouldn't.
Attached patch patch (obsolete) — Splinter Review
I really afraid to change GetPosAndText so changing HypertextOffsetsToDOMRange, it sounds correct but not sure I like this hack.
Assignee: nobody → surkov.alexander
Status: NEW → ASSIGNED
Attachment #335518 - Flags: review?(aaronleventhal)
> it seems we are too, what if we will create accessible for this html:br?

Then we are passing the confusion on to screen readers. An empty textbox should simply be empty. Zero length.

Aaron, do you like the patch approach?
Blocks: 452584, 452599
Attached patch patchSplinter Review
this patch doesn't work with contentEditable because editor is created one for window, so it's not empty in this case, though I put an example, where the document is editable entirely. This approach works for it.
Attachment #335518 - Attachment is obsolete: true
Attachment #335874 - Flags: review?(aaronleventhal)
Attachment #335518 - Flags: review?(aaronleventhal)
Attachment #335874 - Flags: review?(marco.zehe)
Attachment #335874 - Flags: review?(aaronleventhal) → review+
Comment on attachment 335874 [details] [diff] [review]
patch

nit:
In the very first file, there's an edtior instead of an editor.

Thanks for all the maintenance work!
Attachment #335874 - Flags: review?(marco.zehe) → review+
checked in with Marco's comment.

http://hg.mozilla.org/mozilla-central/index.cgi/rev/0b1b33454193
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: