Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: view port observer on lost visibility #17417

Merged
merged 6 commits into from
May 20, 2024

Conversation

PatrykBuniX
Copy link
Contributor

@PatrykBuniX PatrykBuniX commented May 16, 2024

Description

Adds an ability to subscribe to visibility loss after the changing the visibility from "visible", to "not visible at all" (not intersecting at all).

Checklist

  • PR has been self reviewed by the author;
  • Hard-to-understand areas of the code have been commented;
  • If it is a core feature, unit tests have been added;

@codecov-commenter
Copy link

codecov-commenter commented May 16, 2024

Codecov Report

Attention: Patch coverage is 53.84615% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 46.14%. Comparing base (65b87bb) to head (b6aa3d2).
Report is 11 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #17417      +/-   ##
==========================================
- Coverage   46.15%   46.14%   -0.01%     
==========================================
  Files         753      753              
  Lines       24732    24737       +5     
  Branches     5671     5672       +1     
==========================================
+ Hits        11414    11416       +2     
- Misses      11886    11887       +1     
- Partials     1432     1434       +2     

@PatrykBuniX PatrykBuniX marked this pull request as ready for review May 20, 2024 10:03
@PatrykBuniX PatrykBuniX requested review from otto-the-bot and a team as code owners May 20, 2024 10:03
Comment on lines +64 to +66
if (!onVisibilityLost) {
releaseTrackers();
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't want to release the trackers after detecting element's visibility (we want to detect its visibility lost later).

Comment on lines +21 to +26
Element,
{
allowBiggerThanViewport?: boolean;
requireFullyInView?: boolean;
onVisible?: Function;
onVisibilityChange?: (isVisible: boolean, isPartiallyVisible: boolean) => void;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just added types here and renamed onChange to onVisibilityChange for more clarity.

Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@PatrykBuniX PatrykBuniX merged commit 6644e8a into dev May 20, 2024
11 checks passed
@PatrykBuniX PatrykBuniX deleted the feat/view-port-observer-on-lost-visibility branch May 20, 2024 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants