Closed Bug 2044440 Opened 5 months ago Closed 1 month ago

synthesizePlainDragAndDrop() should supress a11y checks for expectCancelDragStart

Categories

(Testing :: Mochitest, defect)

defect

Tracking

(firefox159 fixed)

RESOLVED FIXED
159 Branch
Tracking Status
firefox159 --- fixed

People

(Reporter: jsudiaman, Assigned: Kayano04, Mentored)

Details

(Whiteboard: [good-first-bug][lang=js])

Attachments

(1 external file)

https://searchfox.org/firefox-main/rev/e28b34ab33dbf49364999070168cbb7e11e8e5bd/testing/mochitest/tests/SimpleTest/EventUtils.js#3943-3951

This block, meant to simulate a drop (rather than click), may cause a11y failures:

if (expectCancelDragStart) {
  synthesizeMouse(
    srcElement,
    finalX,
    finalY,
    { type: "mouseup", id },
    srcWindow
  );
  return;
}

Note that in synthesizeDropAfterDragOver(), this is handled correctly:

// Don't run accessibility checks for this click, since we're not actually
// clicking. It's just generated as part of the drop.
// this.AccessibilityUtils might not be set if this isn't a browser test or
// if a browser test has loaded its own copy of EventUtils for some reason.
// In the latter case, the test probably shouldn't do that.
this.AccessibilityUtils?.suppressClickHandling(true);
synthesizeMouse(aDestElement, 2, 2, { type: "mouseup" }, aDestWindow);
this.AccessibilityUtils?.suppressClickHandling(false);

In testing/mochitest/tests/SimpleTest/EventUtils.js, I believe we just need to wrap the synthesizeMouse() call with this.AccessibilityUtils?.suppressClickHandling(true); and this.AccessibilityUtils?.suppressClickHandling(false); – as done in the block above.

To verify, remove the AccessibilityUtils.setEnv({ mustHaveAccessibleRule: false }); and AccessibilityUtils.resetEnv(); lines from the following tests:

And make sure the tests still pass:

./mach test --enable-a11y-checks \
  browser/components/tabbrowser/test/browser/dragdrop/browser_drag_horizontal_overflow.js \
  browser/components/tabbrowser/test/browser/dragdrop/browser_drag_splitview.js
Whiteboard: [good-first-bug][lang=js]
Mentor: jsudiaman

The severity field is not set for this bug.
:florian, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(florian)
Severity: -- → S4
Flags: needinfo?(florian)

I'd like to take this on. I'll reproduce the issue first and then submit a patch via Phabricator.

(In reply to 赤坂理子 from comment #3)

I'd like to take this on. I'll reproduce the issue first and then submit a patch via Phabricator.

Sounds good! I've assigned you. Let me know how it goes.

Assignee: nobody → Kayano04

Follow the existing synthesizeDropAfterDragOver pattern and suppress accessibility click handling only around the cancellation-path mouseup, as suggested in bug 2044440 comment 1.

Remove the horizontal-overflow test waiver and add a real cancelled-drag regression that also verifies subsequent button clicks still run accessibility checks. The splitview test no longer has the old waiver.

Pushed by jsudiaman@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/83a8c125dd55 https://hg.mozilla.org/integration/autoland/rev/3a7b63f1b9d0 Suppress accessibility click checks when cancelling drag start r=jsudiaman,tabbrowser-reviewers
Status: NEW → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 159 Branch
You need to log in before you can comment on or make changes to this bug.