kweb does not open menus properly
Closed this issue · 13 comments
Pick any lesson in the tutorial, say lesson_6 under 1_lambda in 1_k. Then click on [Expand] for the kweb interface. As you can see, the menu does not open precisely where lesson_6 starts; I have to scroll up to see the actual files in the selected folder. We had a similar problem before, but I thought it was fixed.
@grosu browser information? Working for me under Chrome and Firefox, broken under IE. It seems IE has a security feature which prevents changing the positions of elements in iframes (more specifically scrolling iframes, which is how we display kweb in the embedded display). I can try to confirm this later tonight when I'll have access to my Windows install. The autoscrolling should work in all browsers when you click "open full tool page" and all but IE when you click "expand". If your experience is otherwise let me know.
This seems to be one of those idiosyncrasies that's difficult to fix without a lot of changes to the UI structure (the scrolling would have to become server side rather than client side, because I'm not aware of any other way to scroll a div client side). I could be wrong about all of this but this is my recollection of the issue. I will look for a reference to previous discussions to refresh my memory as well.
I use Chrome. I tried it again, both on my desktop and on my laptop, and the same: when I click on [Expand], the online interface opens with the menu somewhere in the middle of the corresponding lesson folder, but not at the beginning of it. So I have to scroll up a bit to get to the lambda.k file. Maybe I should just show you that.
@grosu - Oh I understand and see the issue, that is actually the intended behavior. The idea is to scroll to the file that is being autoloaded in the window (lambda.k) at the top of the bar to help you find the file quickly (especially relevant if there are a lot of files in the folder). This also simplifies things by allowing for only a single URL parameter: ?autoload=tutorial/1_k/1_lambda/lesson_6/lambda.k
At least those were the original design decisions.
If you'd like I can have it scroll to the folder instead, though unless we want another URL parameter we can either have it always scroll to the file or always scroll to the file's directory.
@grosu strange, that is not what I see in Chrome. Are you at 100% zoom level? (Press Ctrl-0, reload the page, then try again.) If not that's something that's very hard to support in terms of scrolling to an element and I'm not sure if there's a practical way of doing this. If you are at 100% zoom level this is probably some sort of font, scaling, or DPI issue I will have to investigate further.
Yes, I was sure it was zoom 100% from the beginning. Note that it works fine if I open it in a full page (not expand).
@grosu OK, I see. Any chance you can test in Firefox and let me know if it's the same issue? That will tell me whether I should be looking into variations of test PC's or whether I need to be doing something browser specific. Thanks!
Phil, it seems to have bigger problems now ... the menu stays open at the top now, and nothing happens when I click on files (imp.k, imp.pdf, etc.).
Grigore
From: Philip Daian [notifications@github.com]
Sent: Friday, January 30, 2015 8:12 AM
To: kframework/kweb
Cc: Rosu, Grigore
Subject: Re: [kweb] kweb does not open menus properly (#25)
@grosuhttps://github.com/grosu OK, I see. Any chance you can test in Firefox and let me know if it's the same issue? That will tell me whether I should be looking into variations of test PC's or whether I need to be doing something browser specific. Thanks!
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/25#issuecomment-72206544.
Hi Grigore,
Maybe a sticky update. Can you try refreshing a few times and seeing if
that fixes it (it's working on my end)?
Otherwise I'll need an hour to take a look, in a class that's strict
about no electronics.
Thanks,
Phil
I tried it in chrome, ie, and firefox; it does not work in any of them. and yes, i refreshed many times.
Grigore
From: Philip Daian [notifications@github.com]
Sent: Friday, January 30, 2015 8:44 AM
To: kframework/kweb
Cc: Rosu, Grigore
Subject: Re: [kweb] kweb does not open menus properly (#25)
Hi Grigore,
Maybe a sticky update. Can you try refreshing a few times and seeing if
that fixes it (it's working on my end)?
Otherwise I'll need an hour to take a look, in a class that's strict
about no electronics.
Thanks,
Phil
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/25#issuecomment-72211130.
@grosu - Thank you for the continued feedback and help tracking this issue down. After a few hours of head banging I've solved the problem.
The issue was as follows:
- When a tutorial page is loaded, even if you do not expand the web interface kweb is actually loaded in the background.
- The automatic scrolling feature calculated the difference between the position of the desired file and the top of the file browser, scrolling the file browser down by that amount. This is how you scroll elements in Javascript. This happened as soon as the kweb page finished loading.
- If the automatic scrolling feature was triggered before you pressed "expand", in some browsers, the position of the file and the top of the file browser were reported incorrectly.
- The solution is to delay the scrolling until the iframe is loaded. Unfortunately, there is no way to explicitly check this. So we check what the browser thinks the total frame height is, if it's 0 (hidden frame), we try to scroll again in .5 seconds. Otherwise we scroll. This means that the scrolling will only happen after the interface is expanded (apparent height > 0).
The affected browser seems to be new versions of Chrome. On an old version of Webkit (old Chrome rendering engine), this bug does not appear. Using Blink (new Chrome rendering engine), this bug appears consistently.
The reason I wasn't seeing this bug on Chrome is because I tended to click "expand" before the kweb page was done loading, meaning that generally the scroll logic would happen after the window was expanded, hiding the bug.
Issue should be fixed in commit a9db61b, @grosu please test and confirm.
Seems to work fine now, but it looks like the link to kweb on this page is wrong: http://www.kframework.org/index.php/Lesson_9,_LAMBDA:_A_Complete_and_Commented_Definition;
it links to Lesson 1.
Thanks, Phil!
Grigore
From: Philip Daian [notifications@github.com]
Sent: Saturday, January 31, 2015 4:23 PM
To: kframework/kweb
Cc: Rosu, Grigore
Subject: Re: [kweb] kweb does not open menus properly (#25)
@grosuhttps://github.com/grosu - Thank you for the continued feedback and help tracking this issue down. After a few hours of head banging I've solved the problem.
The issue was as follows:
- When a tutorial page is loaded, even if you do not expand the web interface kweb is actually loaded in the background.
- The automatic scrolling feature calculated the difference between the position of the desired file and the top of the file browser, scrolling the file browser down by that amount. This is how you scroll elements in Javascript. This happened as soon as the kweb page finished loading.
- If the automatic scrolling feature was triggered before you pressed "expand", in some browsers, the position of the file and the top of the file browser were reported incorrectly.
- The solution is to delay the scrolling until the iframe is loaded. Unfortunately, there is no way to explicitly check this. So we check what the browser thinks the total frame height is, if it's 0 (hidden frame), we try to scroll again in .5 seconds. Otherwise we scroll. This means that the scrolling will only happen after the interface is expanded (apparent height > 0).
The affected browser seems to be new versions of Chrome. On an old version of Webkit (old Chrome rendering engine), this bug does not appear. Using Blink (new Chrome rendering engine), this bug appears consistently.
The reason I wasn't seeing this bug on Chrome is because I tended to click "expand" before the kweb page was done loading, meaning that generally the scroll logic would happen after the window was expanded, hiding the bug.
Issue should be fixed in commit a9db61bhttps://github.com/kframework/kweb/commit/a9db61b1b09bb9866cc44560c010fc46aaaa7394, @grosuhttps://github.com/grosu please test and confirm.
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/25#issuecomment-72339866.
No problem, should be all fixed now (incl Lesson 9).
BTW, you mentioned the issue of the PDFs updating. Those are files in your workspace - if you want to force an update of your workspace to the latest version, clear cookies and you'll get a new workspace.
An even simpler way is to right click the tutorial or samples directory -> restore from original. This will pull in the latest version.
Also, I am testing some changes to the upgrade script tonight, so if you see any strange behavior wait until tomorrow to report it 👍
Thanks for finding the bug! (Closing issue)
Phil