Closed Bug 847233 Opened 11 years ago Closed 11 years ago

Fix a11y with <input type='file'> changes

Categories

(Core :: Disability Access APIs, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla22

People

(Reporter: mounir, Assigned: mounir)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch Patch (obsolete) — Splinter Review
      No description provided.
Attachment #720484 - Flags: review?(surkov.alexander)
Comment on attachment 720484 [details] [diff] [review]
Patch

Review of attachment 720484 [details] [diff] [review]:
-----------------------------------------------------------------

I don't think we really need to propogate states to readonly text inside input@type=file, since it's not focusable and interactive.

Marco, Jamie, agree?

::: accessible/src/html/HTMLFormControlAccessible.cpp
@@ +556,2 @@
>        nsEventShell::FireEvent(childEvent);
>      }

I'd say to skip events firing on label accessible

::: accessible/tests/mochitest/events/test_statechange.html
@@ +77,5 @@
>      {
>        this.fileControlNode = getNode(aID);
>        this.fileControl = getAccessible(this.fileControlNode);
> +      this.browseButton = this.fileControl.firstChild;
> +      this.textEntry = this.fileControl.lastChild;

textEntry is an input, makes sense to rename to 'text' probably

::: accessible/tests/mochitest/tree/test_filectrl.html
@@ +26,3 @@
>            },
>            {
> +            role: ROLE_LABEL

pls, add

children: [
  {
    role: TEXT_LEAF
  }
];

::: layout/forms/nsFileControlFrame.cpp
@@ +180,1 @@
>    aElements.MaybeAppendElement(mTextContent);

curious, why this change is necessary?
(In reply to alexander :surkov from comment #1)
> ::: layout/forms/nsFileControlFrame.cpp
> @@ +180,1 @@
> >    aElements.MaybeAppendElement(mTextContent);
> 
> curious, why this change is necessary?

The Accessible Tree seems to be set based on that and I was adding the text before the button while the button is actually shown *before* the text so I had an accessible tree being inverted (ie. test_filectrl.html was failing).
(In reply to Mounir Lamouri (:mounir) from comment #2)
> (In reply to alexander :surkov from comment #1)
> > ::: layout/forms/nsFileControlFrame.cpp
> > @@ +180,1 @@
> > >    aElements.MaybeAppendElement(mTextContent);
> > 
> > curious, why this change is necessary?
> 
> The Accessible Tree seems to be set based on that and I was adding the text
> before the button while the button is actually shown *before* the text so I
> had an accessible tree being inverted (ie. test_filectrl.html was failing).

oh, I see, native anonymous content array should correspond to visual order.
Flags: needinfo?(jamie)
Comment on attachment 720484 [details] [diff] [review]
Patch

Review of attachment 720484 [details] [diff] [review]:
-----------------------------------------------------------------

This looks pretty good. Alexander do we still needinfo on Jamie?

::: accessible/src/html/HTMLFormControlAccessible.cpp
@@ +556,2 @@
>        nsEventShell::FireEvent(childEvent);
>      }

Agreed no need to fire for label AFAIK.
(In reply to David Bolter [:davidb] from comment #4)

> This looks pretty good. Alexander do we still needinfo on Jamie?

I need someone to confirm the statement about states propogation from comment #1. Do you do that?
(In reply to alexander :surkov from comment #5)
> (In reply to David Bolter [:davidb] from comment #4)
> 
> > This looks pretty good. Alexander do we still needinfo on Jamie?
> 
> I need someone to confirm the statement about states propogation from
> comment #1. Do you do that?

I can try. Can you elaborate the statement? What part of the patch is it referring to?
The statement was that the states like busy, invalid, etc shouldn't be propagated from input@type=file to its child text accessible. It's referring to XULLabelAccessible::State().
Comment on attachment 720484 [details] [diff] [review]
Patch

cancelling until comments are addressed
Attachment #720484 - Flags: review?(surkov.alexander)
Comment on attachment 720484 [details] [diff] [review]
Patch

Review of attachment 720484 [details] [diff] [review]:
-----------------------------------------------------------------

Sorry for the delay. Let's get a try build to Marco.

::: accessible/src/xul/XULElementAccessibles.cpp
@@ +99,5 @@
> +  // Inherit states from input@type="file" suitable for the <xul:label>.
> +  if (mParent && mParent->IsHTMLFileInput()) {
> +    uint64_t parentState = mParent->State();
> +    state |= parentState & (states::UNAVAILABLE | states::BUSY |
> +             states::REQUIRED | states::HASPOPUP | states::INVALID);

I think you can remove this block and you're probably good to go.
(In reply to David Bolter [:davidb] from comment #9)
> Comment on attachment 720484 [details] [diff] [review]
> Patch
> 
> Review of attachment 720484 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> Sorry for the delay. Let's get a try build to Marco.
> 
> ::: accessible/src/xul/XULElementAccessibles.cpp
> @@ +99,5 @@
> > +  // Inherit states from input@type="file" suitable for the <xul:label>.
> > +  if (mParent && mParent->IsHTMLFileInput()) {
> > +    uint64_t parentState = mParent->State();
> > +    state |= parentState & (states::UNAVAILABLE | states::BUSY |
> > +             states::REQUIRED | states::HASPOPUP | states::INVALID);
> 
> I think you can remove this block and you're probably good to go.

Tests would fail without that. Should I fix the tests then?
So, do you guys want me to not propagate the state and not send any events and fix the tests accordingly? (tests will be failing for sure, this patch is the minimum code to make tests pass)
Flags: needinfo?(surkov.alexander)
Flags: needinfo?(dbolter)
Which tests fail if you don't propagate state or fire events for the label?

Personally I think I'd be okay with you landing this so that you can move on and we can do the followup. The states and event firing for the label simply seems unnecessary to me but should be harmless.
Flags: needinfo?(dbolter)
(In reply to Mounir Lamouri (:mounir) from comment #11)
> So, do you guys want me to not propagate the state and not send any events
> and fix the tests accordingly? (tests will be failing for sure, this patch
> is the minimum code to make tests pass)

yes
Flags: needinfo?(surkov.alexander)
Is input still required from me? I was never clear on what input I was supposed to provide. :)
Flags: needinfo?(jamie)
(In reply to James Teh [:Jamie] from comment #14)
> Is input still required from me? I was never clear on what input I was
> supposed to provide. :)

Jamie, we used to propagate states to entry inside input@type=file for example:
<input type="file" aria-required="true" made child entry to have required state too. Since the entry was replaced to not editable/not focusable hypertext then I think we don't need to propagate states anymore. Do you agree?
(In reply to alexander :surkov from comment #15)
> Jamie, we used to propagate states to entry inside input@type=file for
> example:
> <input type="file" aria-required="true" made child entry to have required
> state too. Since the entry was replaced to not editable/not focusable
> hypertext then I think we don't need to propagate states anymore.
The Browse button is still focusable, though, and I assume states are no longer propagated to that? If not, the problem is that the user may never be informed of the states; e.g. required. This is especially true because the container looks fairly generic.
no, no, the button is unchanged
If the button has the states, I probably wouldn't worry about the file name label.
ok, thank you
Attached patch PatchSplinter Review
I removed the event and the state changes and fixes the tests to reflect those changes.
Attachment #720484 - Attachment is obsolete: true
Attachment #729605 - Flags: review?(surkov.alexander)
Marco, could you try a build from https://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/mlamouri@mozilla.com-bd669566f394/ and let me know if <input type='file'> is correct?
Flags: needinfo?(marco.zehe)
This build works well! The file name is visible below the browse button in the NVDA virtual buffer.
Flags: needinfo?(marco.zehe)
Comment on attachment 729605 [details] [diff] [review]
Patch

Review of attachment 729605 [details] [diff] [review]:
-----------------------------------------------------------------

::: accessible/tests/mochitest/events/test_statechange.html
@@ +77,5 @@
>      {
>        this.fileControlNode = getNode(aID);
>        this.fileControl = getAccessible(this.fileControlNode);
> +      this.browseButton = this.fileControl.firstChild;
> +      // We do not check for state change events on the label on purpose.

perhaps: No state change events on the label

::: accessible/tests/mochitest/states/test_aria.html
@@ +136,4 @@
>        testStates(fileBrowseButton,
>                   STATE_BUSY | STATE_UNAVAILABLE | STATE_REQUIRED | STATE_HASPOPUP | STATE_INVALID);
> +      var fileTextField = getAccessible("fileinput").lastChild;
> +      testStates(fileTextField, 0);

giving 0 states you test nothing. I don't think it makes sense to test absence of states on the label so you can just remove it.

::: accessible/tests/mochitest/states/test_inputs.html
@@ +71,3 @@
>      testStates(fileBrowseButton, STATE_UNAVAILABLE | STATE_REQUIRED);
> +    var fileTextField = getAccessible("file").lastChild;
> +    testStates(fileTextField, 0);

same
Attachment #729605 - Flags: review?(surkov.alexander) → review+
Thank you guys for your help with this :)
Target Milestone: --- → mozilla22
(In reply to Mounir Lamouri (:mounir) from comment #25)
> Thank you guys for your help with this :)

thanks to you
https://hg.mozilla.org/mozilla-central/rev/ed73c79342be
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: