Closed Bug 1123771 Opened 9 years ago Closed 9 years ago

XUL textbox[type=search] claims the <image> in it is a button even without the searchbutton attribute

Categories

(Toolkit :: UI Widgets, defect)

defect
Not set
normal
Points:
3

Tracking

()

RESOLVED FIXED
mozilla38
Iteration:
38.3 - 23 Feb
Tracking Status
firefox38 --- fixed

People

(Reporter: Gijs, Assigned: Gijs)

References

Details

Attachments

(1 file)

The binding here: http://hg.mozilla.org/mozilla-central/annotate/c2df1daf74c3/toolkit/content/widgets/textbox.xml#l315

has a <xul:deck> which has a <xul:image>. That's exposed through MSAA as a push button, even when it isn't actually in use as a button (when the searchbutton attribute is not present).

It seems the binding sets aria-autocomplete=list if the searchbutton attribute is not present; Surkov, can you clarify why the deck/image gets exposed as a button in this case? We can hopefully/probably workaround on the toolkit side by setting role=presentation in the constructor and the searchButton setter (see the existing shuffling of attributes in the same) but I'd like to better understand why we even expose this the way we do. Is it just because of the onclick attribute?
Flags: needinfo?(surkov.alexander)
Oh, and I forgot: for a practical example, turn off in-content prefs in about:config (browser.preferences.inContent and browser.preferences.instantApply to false) and open the preferences, then check out the search input at the top of the "Applications" pane.
(In reply to :Gijs Kruitbosch from comment #0)
> The binding here:
> http://hg.mozilla.org/mozilla-central/annotate/c2df1daf74c3/toolkit/content/
> widgets/textbox.xml#l315
> 
> has a <xul:deck> which has a <xul:image>. That's exposed through MSAA as a
> push button, even when it isn't actually in use as a button (when the
> searchbutton attribute is not present).
> 
> It seems the binding sets aria-autocomplete=list if the searchbutton
> attribute is not present; Surkov, can you clarify why the deck/image gets
> exposed as a button in this case?

not offhand, it's worth to check what role this image has

> We can hopefully/probably workaround on
> the toolkit side by setting role=presentation in the constructor and the
> searchButton setter (see the existing shuffling of attributes in the same)
> but I'd like to better understand why we even expose this the way we do. Is
> it just because of the onclick attribute?

onclick should provide accessible action but it shouldn't affect on role, even when mapped to MSAA. Did you check xp role (via DOMInspector for example)?
Flags: needinfo?(surkov.alexander)
(In reply to alexander :surkov from comment #2)
> (In reply to :Gijs Kruitbosch from comment #0)
> > The binding here:
> > http://hg.mozilla.org/mozilla-central/annotate/c2df1daf74c3/toolkit/content/
> > widgets/textbox.xml#l315
> > 
> > has a <xul:deck> which has a <xul:image>. That's exposed through MSAA as a
> > push button, even when it isn't actually in use as a button (when the
> > searchbutton attribute is not present).
> > 
> > It seems the binding sets aria-autocomplete=list if the searchbutton
> > attribute is not present; Surkov, can you clarify why the deck/image gets
> > exposed as a button in this case?
> 
> not offhand, it's worth to check what role this image has

None, it's in anon content and has no role set, AFAICT.
 
> > We can hopefully/probably workaround on
> > the toolkit side by setting role=presentation in the constructor and the
> > searchButton setter (see the existing shuffling of attributes in the same)
> > but I'd like to better understand why we even expose this the way we do. Is
> > it just because of the onclick attribute?
> 
> onclick should provide accessible action but it shouldn't affect on role,
> even when mapped to MSAA. Did you check xp role (via DOMInspector for
> example)?

It doesn't show up in the a11y tree in DOMI. Is this what you mean? If not, what exactly do you mean? :-)
Flags: needinfo?(surkov.alexander)
(In reply to :Gijs Kruitbosch from comment #3)

> > not offhand, it's worth to check what role this image has
> 
> None, it's in anon content and has no role set, AFAICT.

XBL bindings provides own roles on xbl:content element. So it that's image binding then it has role="xul:image", see http://mxr.mozilla.org/mozilla-central/source/toolkit/content/widgets/general.xml#154

>  
> > > We can hopefully/probably workaround on
> > > the toolkit side by setting role=presentation in the constructor and the
> > > searchButton setter (see the existing shuffling of attributes in the same)
> > > but I'd like to better understand why we even expose this the way we do. Is
> > > it just because of the onclick attribute?
> > 
> > onclick should provide accessible action but it shouldn't affect on role,
> > even when mapped to MSAA. Did you check xp role (via DOMInspector for
> > example)?
> 
> It doesn't show up in the a11y tree in DOMI. Is this what you mean? If not,
> what exactly do you mean? :-)

it should, otherwise you cannot see it in MSAA tree as well. or I miss your point
Flags: needinfo?(surkov.alexander)
(In reply to alexander :surkov from comment #4)
> > > > We can hopefully/probably workaround on
> > > > the toolkit side by setting role=presentation in the constructor and the
> > > > searchButton setter (see the existing shuffling of attributes in the same)
> > > > but I'd like to better understand why we even expose this the way we do. Is
> > > > it just because of the onclick attribute?
> > > 
> > > onclick should provide accessible action but it shouldn't affect on role,
> > > even when mapped to MSAA. Did you check xp role (via DOMInspector for
> > > example)?
> > 
> > It doesn't show up in the a11y tree in DOMI. Is this what you mean? If not,
> > what exactly do you mean? :-)
> 
> it should, otherwise you cannot see it in MSAA tree as well. or I miss your
> point

Sorry, it seems like the a11y tree in DOMI is still different on OS X vs. Windows. It does show up in DOMI on Windows, and has role "pushbutton".

How is that possible if the xul:image bit should give it role "image"? :-\
Flags: needinfo?(surkov.alexander)
(In reply to :Gijs Kruitbosch from comment #5)
> Sorry, it seems like the a11y tree in DOMI is still different on OS X vs.
> Windows. It does show up in DOMI on Windows, and has role "pushbutton".

it should be same on OS X

> How is that possible if the xul:image bit should give it role "image"? :-\

I would check bindings chain to see what role it gets from. I just don't see in a11y code how image can be transformed to button, so I blamed XBL bindings.
Flags: needinfo?(surkov.alexander)
Flags: needinfo?(gijskruitbosch+bugs)
(In reply to alexander :surkov from comment #6)
> (In reply to :Gijs Kruitbosch from comment #5)
> > Sorry, it seems like the a11y tree in DOMI is still different on OS X vs.
> > Windows. It does show up in DOMI on Windows, and has role "pushbutton".
> 
> it should be same on OS X

It isn't. On OS X I see an "entry", with name "Search", node name "html:input, and a menupopup with name "Applications" and node name "xul:menupopup", in a "section" named "Search", with node name "textbox".

On Windows the situation is the same *except* it says that the pushbutton with a blank name and node name "xul:image" is there.

The menupopup, fwiw, seems to be the context menu - I can't see any other menupopup.

> > How is that possible if the xul:image bit should give it role "image"? :-\
> 
> I would check bindings chain to see what role it gets from. I just don't see
> in a11y code how image can be transformed to button, so I blamed XBL
> bindings.

There aren't any other bindings for the image in DOMI besides the image binding from general.xml which you linked to.

I'm really sorry, but can you investigate again? I tried looking through the accessible/xul code with a debugger, and while I can see that it's exposing the button role for the image, it's not clear to me how to figure out when the accessible is being created and how to catch that happening for the image (rather than all the other content in the pref window) and thereby being able to tell *why* it's getting created.
Flags: needinfo?(gijskruitbosch+bugs) → needinfo?(surkov.alexander)
apparently xul:image having onclick is exposed as a button http://mxr.mozilla.org/mozilla-central/source/accessible/base/nsAccessibilityService.cpp#1238

do you think the search image shouldn't be a button? (the cross button is markup equivalent but it acts as a button).
Flags: needinfo?(surkov.alexander)
(In reply to alexander :surkov from comment #8)
> apparently xul:image having onclick is exposed as a button
> http://mxr.mozilla.org/mozilla-central/source/accessible/base/
> nsAccessibilityService.cpp#1238

Ah, so my guess in comment #0 was actually correct!

> do you think the search image shouldn't be a button? (the cross button is
> markup equivalent but it acts as a button).

AFAICT the iconClick method just no-ops right now in the case of the preferences window.

We might be able to fix this by fixing the binding to not hardcode the onclick attribute but set it dynamically... not sure how hard this is. I'll have a look.
Flags: needinfo?(gijskruitbosch+bugs)
The only case where we set searchbutton=true outside of tests seems to be the addon manager. For the clear button, I thought that the label should probably always be 'clear', so I've just stuck it in the binding. I've labeled the search button in the add-ons manager using extensions.dtd. Finally, I had to do a little jig with the actual click handler because we don't want it to stop focusing the input, but equally, it doesn't need to be accessible as a button in that case (because tools like that can just focus the input themselves) or have a label. I'm not a great fan of the current solution, but considering we can't override XBL-provided roles, this seems like the most straightforward solution. Try: remote:   https://treeherder.mozilla.org/#/jobs?repo=try&revision=d3eb9587c15e
Attachment #8560413 - Flags: review?(dtownsend)
Assignee: nobody → gijskruitbosch+bugs
Status: NEW → ASSIGNED
Iteration: --- → 38.2 - 9 Feb
Points: --- → 3
Component: Disability Access APIs → XUL Widgets
Flags: needinfo?(gijskruitbosch+bugs) → firefox-backlog+
Product: Core → Toolkit
Summary: XUL textbox[type=search] claims its <deck> and/or the <image> therein is a button even without the searchbutton attribute → XUL textbox[type=search] claims the <image> in it is a button even without the searchbutton attribute
Flags: qe-verify-
Flags: in-testsuite-
Attachment #8560413 - Flags: review?(dtownsend) → review+
Joyous test failures. Fix included in:

remote:   https://treeherder.mozilla.org/#/jobs?repo=try&revision=94b1d8ef9b02

Let's see if this goes better.
remote:   https://hg.mozilla.org/integration/fx-team/rev/db26d58e22b6
Whiteboard: [fixed-in-fx-team]
(In reply to :Gijs Kruitbosch from comment #11)
> Joyous test failures.

I was going to ask... I distinctly remember that we test for the exposed widget tree for this one. And because the patch changed it, we flag it as such. ;) Thanks for fixing the tests and adding one for the other case!
Flags: in-testsuite- → in-testsuite+
Iteration: 38.2 - 9 Feb → 38.3 - 23 Feb
https://hg.mozilla.org/mozilla-central/rev/db26d58e22b6
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → mozilla38
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: