Skip to content

Non-interactive images are added to the page tab order #440

Description

@aidanbruneel

Observed behaviour

When the IMAGE browser extension is enabled, ordinary non-linked images on a webpage are modified to become keyboard-focusable. On https://image.a11y.mcgill.ca/tutorial/, the three content images on the page change from tabindexAttribute: null / tabIndex: -1 to tabindexAttribute: "0" / tabIndex: 0 after enabling the extension and reloading the page. This adds new tab stops to the host webpage and changes its normal sequential keyboard navigation even when the user is not actively trying to invoke IMAGE.

Expected behaviour

IMAGE should provide a keyboard-accessible way to invoke interpretations without unnecessarily changing the host page’s native tab order. Ordinary non-interactive images should remain outside the sequential keyboard focus order unless the page itself makes them focusable or interactive.

Reproduction

  1. Disable the IMAGE browser extension.
  2. Open https://image.a11y.mcgill.ca/tutorial/ in Chrome.
  3. Open the developer console.
  4. Run:
[...document.images]
  .filter(img => !img.closest("a"))
  .map(img => ({
    alt: img.alt,
    tabindexAttribute: img.getAttribute("tabindex"),
    tabIndex: img.tabIndex
  }));
  1. Observe that the page’s three non-linked content images report tabindexAttribute: null and tabIndex: -1.
  2. Enable the IMAGE browser extension.
  3. Reload the page.
  4. Run the same command again.
  5. Observe that the same three images now report tabindexAttribute: "0" and tabIndex: 0.
  6. Tab through the page and observe that these static images now participate in sequential keyboard navigation.

Runtime context

  • Component: IMAGE-browser
  • Page used for reproduction: https://image.a11y.mcgill.ca/tutorial/
  • Browser: Chrome
  • Extension state: reproducible when IMAGE is enabled and the page is reloaded
  • Relevant implementation: src/content.ts adds tabindex="0" to non-linked images, and Ctrl+B processing depends on document.activeElement.tagName == "IMG".

Additional context

This behavior appears to be the implemented result of issue #22, which proposed adding tabindex="0" to images so they could be reached through keyboard navigation and stated that it should not affect site behavior. The new reproduction shows that it does affect site behavior by altering the host page’s tab order. A later issue, #387, also recognized that per-graphic keyboard navigation additions can slow user navigation, and the current Ctrl+B trigger seems to be coupled to this focusability approach.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions