Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Check intersectionRatio to determine visibility correctly #25

Merged
merged 1 commit into from
Feb 27, 2018

Conversation

t9md
Copy link
Contributor

@t9md t9md commented Feb 25, 2018

@leroix hope you check this.

When I implemented #22 originally, I omitted checking intersectionRatio(at that time it seems for me ratio report is somewhat incorrect and judged OK with behavioral check), but
from Atom-v1.25.0, I noticed lots of changes with intersectionRatio === 0 reported, which eventually call elementForItem with {visible: true}, thus break visible-on-render behavior.

This PR correctly determine visibility and make render-on-visible work again.

Impacted issue: atom/command-palette#108

When i implemented originally I omitted checking intersectionRatio, but
from Atom-v1.25.0, I noticed lots of changes with intersectionRatio ===
0 reported, which break visible-on-render behavior.

This PR correctly determine visibility and make render-on-visible work
again.

containerNode.appendChild(selectListView.element)

const children = selectListView.refs.items.children
children[20].scrollIntoViewIfNeeded()
await assertItemsBecomeVisible([17, 18, 19, 20, 21, 22, 23])
await assertItemsBecomeVisible([18, 19, 20, 21, 22])
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you help me understand why these needed to change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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


17 and 23 here was "BecomeVisible" because by intersectionRatio === 0 not by intersectionRatio > 0, even in non-problematic Atom-v1.24.0.
So this is the spec created based on incorrect behavior. Now fixed incorrectly behavior, so need to fix spec too.
Just when I implemented it in Atom-v1.24.0, I didn't noticed this incorrectness.

[
  17, # intersectionRatio == 0
  18, # intersectionRatio == 1
  19, # intersectionRatio == 1
  20, # intersectionRatio == 1
  21, # intersectionRatio == 1
  22, # intersectionRatio == 1
  23, # intersectionRatio == 0
]

To be precise

  • Atom-v1.24.0(Chrome : 56.0.2924.87) affect this bug, but not severe, it's just report border TWO invisible elements as intersectionRatio === 0.
  • Atom-v1.25.0-beta2(Chrome: 58.0.3029.110) affect this bug severely, it's report ALL elements as intersectionRatio === 0.

I think this change comes from chrome version change by electron version up.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the explanation! Makes sense to me.

@daviwil daviwil merged commit 0aa6e42 into atom:master Feb 27, 2018
@t9md
Copy link
Contributor Author

t9md commented Feb 27, 2018

Thanks for merging this quickly!

@daviwil
Copy link
Contributor

daviwil commented Feb 27, 2018

I'll see if I can get updates of atom-select-list and command-palette out today then get it bumped into the next 1.25.0-beta release.

@daviwil
Copy link
Contributor

daviwil commented Feb 27, 2018

atom-select-list and command-palette have been updated and bumped in 1.25-releases and master!

@t9md
Copy link
Contributor Author

t9md commented Feb 28, 2018

@daviwil Great! Thanks!!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants