question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`entry.intersectionRatio` is not exactly 1.0

See original GitHub issue

Details

  • Browser and browser version: Electron 6
  • OS version: Win 10
  • xterm.js version: 4.9.0

Steps to reproduce

We hit a strange bug that was blocking us for a couple of days. Until we found the intersectionRatio is sometimes near to 1.0 (like 0.99) but not exactly 1.0.

https://github.com/atom-ide-community/terminal/issues/5#issuecomment-689720693 https://github.com/atom-ide-community/terminal/issues/5

I just wanted to let you know about this behavior.

We had a condition to create xterm Element only if intersectionRatio === 1.0 which was not being triggered (this condition was to avoid https://github.com/bus-stop/x-terminal/issues/57).

Suggestion

Introduce a boolean value that shows if the intersectionRatio is almost 1.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
UziTechcommented, Sep 10, 2020

I feel like fit being called on a hidden element or one with 0 width or height shouldn’t throw an error. It should just check for that situation and return early without doing anything. I can’t see a situation where that would be a problem.

1reaction
UziTechcommented, Sep 10, 2020

It already seems to do something similar if the terminal isn’t connected to the dom

https://github.com/xtermjs/xterm.js/blob/4e18a78c02d0bcb5b97eeeb741d5e3c0b996cdc3/addons/xterm-addon-fit/src/FitAddon.ts#L36-L38

Read more comments on GitHub >

github_iconTop Results From Across the Web

IntersectionObserverEntry.intersectionRatio - Web APIs | MDN
Value. A number between 0.0 and 1.0 which indicates how much of the target element is actually visible within the root's intersection rectangle....
Read more >
IntersectionObserver isIntersecting property never is false if ...
By default the threshold is 0, so the callback is called when the element enters or leaves the viewport. When you change the...
Read more >
IntersectionObserverEntry.intersectionRatio - Web APIs
A number between 0.0 and 1.0 which indicates how much of the target element is actually visible within the root's intersection rectangle. More...
Read more >
IntersectionObserver intersectionRatio < 1 observed
As I do that, I see an observation with intersection ratio ~=0.99 about half the time. A few significant facts: The 0.99 ratio...
Read more >
A Few Functional Uses for Intersection Observer to Know ...
You might not know this, but JavaScript has stealthily accumulated quite a number of ... threshold – An array of values (between 0...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found