Skip to content

Summary ​

This implementation introduces non-interactive logic to evaluate whether a UI element is functionally disabled. The goal is to avoid direct interactions (e.g., clicks that could trigger navigation or side effects) and instead execute a battery of passive checks that feed a scoring system (score). When the accumulated score reaches the defined threshold, the element is classified as functionally disabled.

Scope ​

  • Objective: Determine the "functionally disabled" state of HTML elements without producing side effects.
  • Target elements: BUTTON, A, INPUT, and equivalent/role-based interactive elements.
  • Does not: Perform real clicks, form submissions, navigation, or permanent DOM mutations.

Motivation ​

  • Avoid false positives caused by styles/UX that simulate disabling without using the disabled attribute.
  • Provide quantifiable signals for automated decisions and accessibility reporting.
  • Comply with the internal guideline of ticket #430 regarding non-intrusive tests.

Process Flow ​

  1. Precise element location by unique ID (re-resolution to avoid stale references).
  2. Score initialization at 0 and a checks[] array for logging.
  3. Atomic check execution (without triggering interaction) and score accumulation.
  4. Final threshold decision: if score ≥ 4 → Functionally disabled.

Scoring System ​

  • Check 1 (3 pts): pointer-events: none → blocks mouse interaction. Reasoning: Mouse interactions are nullified.
  • Check 2 (2 pts): Focusability: blur() is attempted and then focus(), validated against document.activeElement === el. If the element cannot receive focus → +2 pts. Reasoning: Disabled elements typically cannot receive focus.
  • Check 3 (1 pt): CSS cursor: not-allowed → +1 pt. Additional: if the element is a BUTTON or A and cursor: default → +1 pt (visual/UX disable heuristic).
  • Check 4 (1 pt): Absence of direct onclick or onclick attribute in BUTTON/A/INPUT → +1 pt. Note: Weak heuristic; events can be delegated.
  • Check 5 (1 pt): CSS opacity in (0, 0.5) (exclusive) → +1 pt (indication of visual/UX disabling).

Decision threshold: score ≥ 4 ⇒ Functionally disabled.