Closed Bug 1660363 Opened 4 years ago Closed 4 years ago

Focus gets stuck in print preview when tabbing

Categories

(Toolkit :: Printing, defect, P2)

defect

Tracking

()

VERIFIED FIXED
82 Branch
Accessibility Severity s2
Tracking Status
firefox81 --- verified
firefox82 --- verified

People

(Reporter: Jamie, Assigned: Jamie)

References

Details

(Keywords: access, Whiteboard: [print2020_v81])

Attachments

(1 file)

STR (on Windows; keystrokes/focus behaviour might be different on other OS):

  1. Open this URL:
    data:text/html,<a href="https://mozilla.org/">Mozilla</a>
  2. Press shift+tab to focus the print preview.
  3. Repeatedly press tab and shift+tab to move focus out of the print preview.
    • Expected: Tab should move focus out of the print preview. A few presses of shift+tab should, too.
    • Actual: It doesn't; focus is stuck!
  4. Press control+l to focus the address bar.
  5. Press tab three times to focus the print preview.
  6. Repeatedly press tab and shift+tab to move focus out of the print preview.
    • Expected: Tab should move focus out of the print preview. A few presses of shift+tab should, too.
    • Actual: It doesn't; focus is stuck!

This is particularly bad combined with bug 1660359, since a screen reader user won't even know where focus landed and got stuck.

There are a few open questions here:

  1. Why does focus get stuck? Note that this doesn't happen if there are no focusable elements in the document. However, as soon as there is one focusable element, this happens.
  2. Is it useful to be able to focus the print preview at all? I'm guessing keyboard only sighted users might want to do this to scroll the preview, assuming this works?
  3. Should we even be able to tab or shift+tab into the print preview? My initial feeling was that tab/shift+tab should be restricted to the print settings and the browser chrome. If one did want to focus the print preview, one could do that with f6. However, this might be considered strange because the print preview is part of the print modal. Also, f6 is less discoverable if (2) is a common use case.

If we did want to disallow tabbing into the print preview (whether permanently or as an interim fix for getting stuck), maybe setting tabindex="-1" on its browser element would work, though I'm not sure. This does seem to work on iframes.

Blocks: 1657994, 133787

This should be fixed by bug 1657459 (which will prevent us from tabbing into it.

Depends on: 1657459
Severity: -- → S2
Priority: -- → P2
Whiteboard: [access-s2] → [access-s2][print2020_v81]

(In reply to James Teh [:Jamie] from comment #0)

If we did want to disallow tabbing into the print preview (whether permanently or as an interim fix for getting stuck), maybe setting tabindex="-1" on its browser element would work

It does, but it also prevents f6 from focusing the print preview.

Previously, IsFocusable returned true on elements in print preview documents, but the element wouldn't accept focus.
This meant that when you tried to tab, focus would get stuck on the document.
Now, IsFocusable returns false.
Thus, tab doesn't try to stop on these elements and can move out of the document.

The patch in comment 3 fixes this, but I suspect this probably isn't the right place to put this code.

Assignee: nobody → jteh
Status: NEW → ASSIGNED
Attachment #9171635 - Attachment description: Bug 1660363: Don't treat HTML elements in static documents as focusable. → Bug 1660363: Don't treat elements inside print preview documents as focusable.
Pushed by jteh@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/44d25518ea20
Don't treat elements inside print preview documents as focusable. r=emilio,mstriemer
No longer depends on: 1657459

The failure was intermittent and was due to bug 1327274. If you shift+tab to print preview before the preview is initialised (i.e. while it is just a blank document), you won't be able to shift+tab any further. I haven't been able to reproduce this in manual testing, so I think it'll be pretty rare in the real world. For now, I worked around it in the test by waiting for the preview to be ready before shift+tabbing to it.

Flags: needinfo?(jteh)
Pushed by jteh@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d8a3ede94c32
Don't treat elements inside print preview documents as focusable. r=emilio,mstriemer
Regressions: 1661392
Pushed by btara@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5716e30c3598
Don't treat elements inside print preview documents as focusable. r=emilio,mstriemer
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 82 Branch
Flags: needinfo?(jteh)

Reminder to request beta approval.

Flags: needinfo?(jteh)

Comment on attachment 9171635 [details]
Bug 1660363: Don't treat elements inside print preview documents as focusable.

Beta/Release Uplift Approval Request

  • User impact if declined: Keyboard users (including screen reader users) will get "trapped" if they tab into print preview in the new print modal.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Change only affects print preview focusability. Covered by tests.
  • String changes made/needed: None.
Flags: needinfo?(jteh)
Attachment #9171635 - Flags: approval-mozilla-beta?

Comment on attachment 9171635 [details]
Bug 1660363: Don't treat elements inside print preview documents as focusable.

Approved for 81.0b5.

Attachment #9171635 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Flags: qe-verify+
QA Whiteboard: [qa-triaged]

Confirming this issue as verified fixed using Windows 10x64, macOS 10.15 and Ubuntu 18.04. Verified with 81.0b8 and 82.0a1 (2020-09-09).

Status: RESOLVED → VERIFIED
Flags: qe-verify+
Accessibility Severity: --- → s2
Whiteboard: [access-s2][print2020_v81] → [print2020_v81]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: