Page MenuHomePhabricator

Bug 2044440 - Suppress accessibility click checks when cancelling drag start r=jsudiaman
ClosedPublic

Authored by Kayano04 on Sep 29 2026, 2:11 PM.
Referenced Files
Unknown Object (File)
Wed, Nov 18, 3:41 PM
Unknown Object (File)
Sun, Nov 1, 12:28 AM
Unknown Object (File)
Thu, Oct 29, 8:07 PM
Unknown Object (File)
Thu, Oct 29, 8:07 PM
Unknown Object (File)
Thu, Oct 29, 8:07 PM
Unknown Object (File)
Thu, Oct 29, 8:07 PM
Unknown Object (File)
Thu, Oct 29, 8:07 PM
Unknown Object (File)
Thu, Oct 29, 8:07 PM

Details

Summary

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 test. The splitview test no longer has the old waiver.

Test Plan

Review update: local verification of the simplified test, based on f3333be0503b9cb51dcd1b442c3175054fa592e2 (the latest shared main/autoland ancestor when checked). macOS 26.4.1 / arm64, optimized Firefox artifact build. No try push or executed upstream test results; Linux/Windows/debug/leak-check validation is not established.

The first review update used main tip f384c89fc98, which contains one main-only sidebar backout that had not reached autoland. Phabricator therefore reported its merge check as unknown (base not an ancestor of the target). The same single commit was rebased one main commit earlier to f3333be0503; the source patch is byte-for-byte unchanged. Rebuilt and reran the negative control and all validation below on this final base, with the same outcomes. No autoland-only commits were included.

The test is now browser_EventUtils_drag_and_drop.js / test_cancelled_drag(). It uses document.createElement("div"), no CSS, no Sinon/spies, and no subsequent button click. The remaining assertions confirm the real dragstart cancellation and generated click. The EventUtils fix and horizontal-overflow waiver removal are unchanged.

Current-patch commands and results:

  1. ./mach build: passed after each rebase, including the final shared main base. This is an artifact build using downloaded compiled C++ components, not a full native rebuild. No build faster was needed for the test edits.
  1. ./mach test --headless --enable-a11y-checks testing/mochitest/tests/browser/browser_EventUtils_drag_and_drop.js: passed with the CSS removed, 6 checks / 1 test. Negative control: temporarily reverting only the two EventUtils suppression calls makes the same simplified test fail with "Node is not accessible via accessibility API: id: , tagName: div, className:" from the cancellation-path mouseup. Both dragstart and click assertions still pass, demonstrating the drag was actually exercised. The two-line fix was restored and verified unchanged before the passing runs below.
  1. ./mach test --headless --enable-a11y-checks --repeat 9 testing/mochitest/tests/browser/browser_EventUtils_drag_and_drop.js browser/components/tabbrowser/test/browser/dragdrop/browser_drag_horizontal_overflow.js browser/components/tabbrowser/test/browser/dragdrop/browser_drag_splitview.js: passed, 711 checks / 28 test executions / zero unexpected results. Observed executions: 9 new-regression, 9 horizontal-overflow, 10 splitview. The harness includes 10 existing TODOs; no skips or TODOs were added.
  1. ./mach test --headless --enable-a11y-checks --repeat 3 browser/components/tabbrowser/test/browser/dragdrop: passed, 1369 checks / 39 test executions / zero unexpected results.
  1. ./mach test --headless dom/events/test/test_bug508479.html dom/events/test/pointerevents/test_wpt_pointerevent_drag_interaction-manual.html dom/events/test/test_dragstart_form_associated_custom_element.html: passed, 57 checks / 3 tests / zero unexpected results. Covers cancellation callers without browser-test AccessibilityUtils.
  1. ./mach test --headless --enable-a11y-checks dom/events/test/browser_dragimage.js testing/mochitest/tests/browser/browser_EventUtils_drag_and_drop.js: passed, 9 checks / 2 tests / zero unexpected results.
  1. ./mach test --headless testing/mochitest/tests/browser/browser_EventUtils_drag_and_drop.js: passed with a11y checks disabled, 6 checks / 1 test / zero unexpected results.
  1. ./mach test --enable-a11y-checks testing/mochitest/tests/browser/browser_EventUtils_drag_and_drop.js: headed run also passed without CSS, 6 checks / 1 test / zero unexpected results.
  1. ./mach format: passed, 0 errors / 0 warnings / 0 fixes.
  1. ./mach lint -W -- testing/mochitest/tests/SimpleTest/EventUtils.js testing/mochitest/tests/browser/browser_EventUtils_drag_and_drop.js testing/mochitest/tests/browser/browser.toml browser/components/tabbrowser/test/browser/dragdrop/browser_drag_horizontal_overflow.js: passed, 0 errors / 0 warnings.
  1. git diff --check, git diff --cached --check, git show --format= --check HEAD: passed. Self-reviewed the entire resulting patch and the range-diff against the previous submission: only the requested test simplification/rename, registration, and corresponding commit description changed. The amended commit contains 4 files, 33 additions / 3 deletions. Source diff matches the validated export byte-for-byte; only one local commit is ahead of the new base. No added test exemptions, dependencies, public API changes, or unrelated edits.

Earlier evidence and caveats retained from the first upload:

  • Before changing EventUtils.js initially, a minimal real cancelled-drag test reproduced the actual a11y error. The existing horizontal-overflow scroll button is already an accessible pushbutton, so removing its waiver alone no longer reproduces the bug. The current splitview test no longer has the old waiver.
  • One earlier full-directory run on the previous base failed in browser_drag_to_pin.js cleanup: "Found an unexpected popup at the end of test run: panel#tab-preview-panel". Drag assertions had completed; it was not an a11y failure. Repeating the whole directory with --repeat 3 on both the exact unmodified old base and the unchanged old patch passed (1369 checks / 39 test executions each). The test uses the unchanged synthesizeDragOver/synthesizeDropAfterDragOver path. The root cause remains unconfirmed; passing reruns do not prove the failure unrelated. This round's full-directory repeat also passed without changing preferences, tests, or skips.
  • The earlier spy-based test initially failed due to a missing Sinon import; that was corrected before the first upload. This update removes Sinon entirely. An earlier lint invocation omitted the -- separator after -W; the corrected command passed. Neither is an outstanding failure.

Diff Detail

Event Timeline

phab-bot changed the visibility from "Custom Policy" to "Public (No Login Required)".
phab-bot changed the edit policy from "Custom Policy" to "Restricted Project (Project)".
phab-bot removed a project: secure-revision.

Changes to browser_drag_horizontal_overflow.js and EventUtils.js LGTM.

Regarding the test file: I have a slight preference to name it something like browser_EventUtils_drag_and_drop.js – thus, in the future, we can add more drag and drop tests to this suite.


Please review feedback, and amend your commit (as opposed to stacking or creating a new one) with any changes before resubmitting. Thanks a lot for your patch!

testing/mochitest/tests/browser/browser_EventUtils_cancelDrag.js
9 ↗(On Diff #1391571)

thought: I'm a bit concerned about this test being too tautological / tightly coupled to how EventUtils + AccessibilityUtils interact. With your changes in place, synthesizePlainDragAndDrop(...) completes without needing to suppress – that is, effectively, the test of assertCanBeClicked not being called (when --enable-a11y-checks is enabled).

Registering specific spies here might break with any future rework to AccessibilityUtils. I'd prefer to reframe this as test_cancelled_drag(), and then remove the spies and extra button click after the drag.

10–13 ↗(On Diff #1391571)

I don't think we need to specify the namespace.

16–17 ↗(On Diff #1391571)

Why is the CSS needed?

50–53 ↗(On Diff #1391571)

Ditto, shouldn't need namespace.

This revision now requires changes to proceed.Sep 29 2026, 6:29 PM
Kayano04 updated this revision to Diff 1392084.
Kayano04 edited the summary of this revision. (Show Details)
Kayano04 edited the test plan for this revision. (Show Details)

Thanks for the review! Amended the existing commit rather than adding another one:

  • Renamed the file to browser_EventUtils_drag_and_drop.js and the task to test_cancelled_drag().
  • Removed Sinon, the spies, and the subsequent button click. The test now only exercises the real cancelled drag and checks the dragstart/click events, without coupling to AccessibilityUtils internals.
  • Changed the source to document.createElement("div").
  • The CSS was unnecessary: removed it entirely and verified the test both headless and headed. Temporarily reverting only the two EventUtils suppression calls still produces the original "Node is not accessible via accessibility API" failure, while both event assertions pass. Restoring the fix makes the test pass.

Rebased onto current main and reran the focused regressions, full dragdrop directory, compatibility tests, formatting and lint; commands/results are in the updated Test Plan. The two-line EventUtils fix and horizontal-overflow waiver removal are unchanged. The earlier popup-cleanup failure and its unconfirmed root cause remain disclosed there.

Kayano04 edited the test plan for this revision. (Show Details)

Base-only follow-up: the previous main tip had one sidebar backout not yet present on autoland, so Phabricator could not check the merge. Rebased the same commit onto the latest shared main/autoland ancestor, f3333be0503. The source patch is byte-for-byte unchanged; no autoland-only commits were added.

Rebuilt and reran the negative control (still detects the original a11y error), focused repetitions, full dragdrop repetitions, compatibility tests, a11y-off/headed controls, formatting and lint on this final base. All positive runs passed; the updated Test Plan records the commands, results and existing caveats.

This revision is now accepted and ready to land.Sep 30 2026, 11:43 AM