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

[Visibility] Wrong logic for reverse events? #6515

Open
soar opened this issue Aug 2, 2018 · 1 comment
Open

[Visibility] Wrong logic for reverse events? #6515

soar opened this issue Aug 2, 2018 · 1 comment

Comments

@soar
Copy link

soar commented Aug 2, 2018

Quick explanation

semantic-ui-visibility

Steps

  1. Create some elements for testing:
    ...
    <div id="element1" class="test-element"></div>
    <div id="element2" class="test-element"></div>
    <div id="element3" class="test-element"></div>
    ...
  2. Use visibility module on them:
    $('.test-element').each(function () {
    	$(this).visibility({
    		once: false,
    		onTopVisible: function () {
    			console.log("onTopVisible for element", $(this).attr('id'))
    		},
    		onTopVisibleReverse: function () {
    			console.log("onTopVisibleReverse for element", $(this).attr('id'))
    		}
    	});
    });

Expected Result

In Semantic-UI 2.2.10 it works as expected: reverse event was fired only when element goes back to same edge, where it was appeared.

I think, if event is named reverse it should be fired only when element goes back. At this moment it works as onTopInvisible.

image

Actual Result

reverse event is fired even if element goes through the screen and goes from another edge.

Version

2.2.10 - works as expected
2.3.3 - looks like broken

Testcase

https://jsfiddle.net/soarx/ugv49aLm/

@y0hami
Copy link
Member

y0hami commented Aug 3, 2018

I think this is just down to some bad naming rather than the events being wrong. Maybe the event names should be changed to better represent why/when they are called.

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

No branches or pull requests

2 participants