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

inview.js doesn't check computed styles #1873

Closed
danielstorey opened this issue Nov 21, 2017 · 1 comment · Fixed by #1882
Closed

inview.js doesn't check computed styles #1873

danielstorey opened this issue Nov 21, 2017 · 1 comment · Fixed by #1882
Assignees

Comments

@danielstorey
Copy link
Member

I came across an issue where I was unable to complete a text component within a trickle article due to the fact that setCompletionStatus was called whilst inview but _isVisible === false on the model.

The result was that the model was not set as complete but the inview listener was removed meaning the setCompletionStatus could never get called again and the component could never be completed.

inview.js only checks an element's style attribute but not computed style, meaning isVisible will be passed as true when the element (or parent) has the .visibility-hidden class.

I suggest we alter the checks to use getComputedStyle instead in the lines below

https://github.com/adaptlearning/adapt_framework/blob/master/src/core/js/libraries/inview.js#L507-L518

@oliverfoster
Copy link
Member

oliverfoster commented Nov 27, 2017

@danielstorey have you got a proof of concept or a PR I could steal a look at?

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 a pull request may close this issue.

2 participants