Skip to content

How do we test definitions? (Add visibility tests with (horizontal) scroll?) #2081

Open
@Jym77

Description

@Jym77

A problem I've been considering while trying to improve the visibility tests in Alfa…

As per our definition of visibility, content that can be scrolled into viewport is considered visible. I guess this was mostly added for vertical scrolling, which is the most frequent case, but it also covers horizontal scrolling:

<style>
  .container {
      overflow: scroll;
  }
  .target {
      position: relative;
      left: 99999px
  }
</style>

<div class="container">
  Hello World <br />
  <div class="target">
    Lorem Ipsum
  </div>
</div>

Here, the :target element is pushed offscreen to the right, but a scrollbar is added to its parent .container making it visible as per our definition. A similar (and more natural) example can easily be made with vertical scrolling (which could be either the .container own scrolling, or the default scrolling of the browser window, depending on the case).


Now, in our examples for visibility (which are mostly spread around the various rules that use the definition), we tend to have cases with left: -9999px to verify that tools handle this case (invisible content). But iirc we do not have any test with content that appear to be invisible but can be scrolled in. That is, we never exerce the "can be scrolled in" part of the definition when validating tools implementation.
As always, testing definition is a bit clumsy in ACT rules since we can only test rules that rely on them and we tend to end up either copying the same-ish test in many rules, or having somewhat partial coverage for the definitions.

Anyway, should we add some test cases on rules concerned about visibility to verify that tools consider the "can be scrolled in" part of the definition?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions