Skip to content

Conversation

@cacieprins
Copy link
Contributor

@cacieprins cacieprins commented Dec 10, 2025

Expands the visibility section in "interacting with elements" to include the "fast" visibility algorithm heuristics/semantics. Cross-references with links, and links to the main github issue tracking this experiment.

@cacieprins cacieprins marked this pull request as ready for review December 10, 2025 17:37
@AtofStryker AtofStryker self-requested a review December 10, 2025 17:42
@cypress
Copy link

cypress bot commented Dec 10, 2025

cypress-documentation    Run #814

Run Properties:  status check passed Passed #814  •  git commit 4107d34ef3: another edit pass
Project cypress-documentation
Branch Review experimental-fast-visibility
Run status status check passed Passed #814
Run duration 04m 14s
Commit git commit 4107d34ef3: another edit pass
Committer Cacie Prins
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 311
View all changes introduced in this branch ↗︎
UI Coverage  10.66%
  Untested elements 2549  
  Tested elements 3  
Accessibility  97.21%
  Failed rules  0 critical   3 serious   4 moderate   0 minor
  Failed elements 26  

#### An element is considered hidden if:

- Its `width` or `height` is `0`.
- Its CSS property (or ancestors) is `visibility: hidden`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More of a nit but this reads kind of strange to me since elements can have multiple properties? Feel free to ignore this since you are just moving the section 😅

Suggested change
- Its CSS property (or ancestors) is `visibility: hidden`.
- It (or ancestors) has CSS property `visibility: hidden`.

hidden when
[asserting on the element's visibility directly](/app/references/assertions#Visibility).

However elements where the CSS property (or ancestors) is `opacity: 0` are
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
However elements where the CSS property (or ancestors) is `opacity: 0` are
However, elements where the CSS property (or ancestors) is `opacity: 0` are


#### Limitations

Experimental fast visibility is an experimental feature that is still under development. It is not yet fully compatible with the legacy visibility algorithm.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this imply that we are trying to achieve backwards compatibility at some point?


The fast visibility algorithm provides several advantages over the legacy algorithm:

- **Better performance**: Constant-time in the best case, and bounded exponential in the worst case (when point sampling on a fully hidden element)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we know how this compares directly to the current algorithm or is determining complexity for that incredibly challenging to distill briefly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unbounded exponential, but it's pretty variable depending on the DOM & the subject element


:::caution

The experimental fast visibility algorithm is not yet fully compatible with the legacy visibility algorithm. Tests that rely on edge-case behavior of the legacy visibility algorithm may fail or behave incorrectly.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This transition feels awkward but I don't love my suggestion.

Suggested change
The experimental fast visibility algorithm is not yet fully compatible with the legacy visibility algorithm. Tests that rely on edge-case behavior of the legacy visibility algorithm may fail or behave incorrectly.
The experimental fast visibility algorithm is not yet fully compatible with the legacy visibility algorithm. Tests that rely on edge-case behavior of the legacy visibility algorithm may fail or behave incorrectly. Remember, following apply to the experimental fast visibility algorithm:

@AtofStryker
Copy link
Contributor

@cacieprins can you change the target of this to point to #6330 chore/release_15_8_0_docs?

@AtofStryker AtofStryker changed the base branch from release/15.8.0 to chore/release_15_8_0_docs December 16, 2025 19:24
@AtofStryker AtofStryker merged commit 5e30ae1 into chore/release_15_8_0_docs Dec 16, 2025
11 checks passed
@AtofStryker AtofStryker deleted the experimental-fast-visibility branch December 16, 2025 20:08
AtofStryker added a commit that referenced this pull request Dec 16, 2025
* chore: add basic entry for cypress 15.8.0

* chore: add angular 21 documentation (#6326)

* doc: add docs for synchronous XHR requests (#6332)

* Experimental fast visibility (#6337)

* initial experiment documentation

* add default & fast visibility semantics, cross-reference links

* add history entry to experiments page

* add link to github issue for the experimental fast visibility experiment

* add note that scrolling is a future enhancement/fix

* edit pass

* another edit pass

---------

Co-authored-by: Bill Glesias <[email protected]>

* chore: add 15.8.0 changelog (#6339)

---------

Co-authored-by: Matt Schile <[email protected]>
Co-authored-by: Cacie Prins <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants