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

Fix #3093: Popover of Userhelp button remains constant when the user creates the exploration for the first time. #3267

Merged
merged 8 commits into from
Apr 9, 2017

Conversation

shaz13
Copy link
Contributor

@shaz13 shaz13 commented Apr 1, 2017

#3093
The tooltip "To get help in future click here" doesn't disappear on the click and causes unintended behavior with profile menu.

How to produce error?

  1. Login in locally with a new username or just use the test user name with admin panel.
  2. Create an exploration. This should pop up the tooltip "To get help in future click here"
  3. Now, click on the profile icon and try to go to any nav element.

Error

  1. The menu simply disappears and user can't navigate to any page from menu

Expected behavior

  1. The tooltip must be not cut off.
  2. It should not block user from accessing menu.

screenshot from 2017-04-01 09-16-05

This PR's fix

screenshot from 2017-04-01 22-28-42
screenshot from 2017-04-01 22-28-46

Added .popover class that overtakes thridparty.css class
@shaz13 shaz13 self-assigned this Apr 1, 2017
@shaz13 shaz13 requested a review from jaredsilver April 1, 2017 17:07
@codecov-io
Copy link

codecov-io commented Apr 1, 2017

Codecov Report

Merging #3267 into develop will increase coverage by 0.34%.
The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #3267      +/-   ##
===========================================
+ Coverage     45.6%   45.95%   +0.34%     
===========================================
  Files          222      237      +15     
  Lines        18176    18350     +174     
  Branches      2931     2951      +20     
===========================================
+ Hits          8290     8433     +143     
- Misses        9886     9917      +31
Impacted Files Coverage Δ
...es/exploration_editor/EditorNavigationDirective.js 2.43% <0%> (-0.13%) ⬇️
...re/templates/dev/head/pages/dashboard/Dashboard.js 42.1% <0%> (-0.76%) ⬇️
...emplates/dev/head/pages/preferences/Preferences.js 41.41% <0%> (-0.7%) ⬇️
core/templates/dev/head/filters.js 62.03% <0%> (-0.12%) ⬇️
...es/exploration_player/ConversationSkinDirective.js 2.25% <0%> (-0.01%) ⬇️
...nteractions/LogicProof/static/js/tools/teacher2.js 92.85% <0%> (ø) ⬆️
...ev/head/pages/exploration_editor/RouterServices.js 0.92% <0%> (ø) ⬆️
...ges/exploration_editor/settings_tab/SettingsTab.js 0.6% <0%> (ø) ⬆️
...sions/interactions/LogicProof/static/js/teacher.js 88.63% <0%> (ø) ⬆️
core/templates/dev/head/pages/profile/Profile.js 1.31% <0%> (ø) ⬆️
... and 52 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cf97126...9f86a93. Read the comment docs.

Copy link
Contributor

@jaredsilver jaredsilver left a comment

Choose a reason for hiding this comment

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

Thanks, @shaz13! This looks good to me. However, while it solves the problem of not being able to access the navigation dropdown, I'm going to loop in @anthkris for an opinion on whether this is sufficient or if we still want to also make the popover disappear after five seconds or on click.

@anthkris -- I feel like this is probably sufficient, but is there anything else I'm not considering?

@anthkris
Copy link
Contributor

anthkris commented Apr 4, 2017

@jaredsilver @shaz13 My gut feeling is that it ought to fade out after several seconds (5 at least, I think). I mean it's just sitting there, tooltip in perpetuity. It's not in anyone's way anymore, but it might still be distracting.

Also @shaz13, I noticed that it doesn't travel with the page when the screen is resized. That seems like an issue.
screen shot 2017-04-03 at 9 10 50 pm

@shaz13
Copy link
Contributor Author

shaz13 commented Apr 4, 2017

@anthkris After going through the code-base realized that, "5 second" popup rule is already present.

After exploring and testing further. The current behavior seems apt with the code. The $scope value does changes from true to false. But, the catch is, it takes the whole page to reload to reflect the change in values. Hence, the popup never disappears within the 5 second timeout

Do correct me if my theory does not set right.

Please do suggest a further approach.

  • Shall I remove the existing script and replace with new one

                                         or
    
  • Debug the present script, and load things using ajax or so?

Kindly do guide me @anthkris @jaredsilver
Thanks

@anthkris
Copy link
Contributor

anthkris commented Apr 4, 2017

Okay @shaz13 I think I get what you're saying. So my recommendation would be to try and figure out how to get that script to work (in other words, debug first). If there's just no way it can work in it's current form, then try fix it some other way.

@jaredsilver
Copy link
Contributor

I'm not terribly familiar with Angular, but from my very limited understanding what I suspect may be happening here is the view is not properly synchronizing with $scope. Again, I've never really worked with Angular, but one line of inquiry might be around $scope.$apply().

This might be of interest: https://nathanleclaire.com/blog/2014/01/31/banging-your-head-against-an-angularjs-issue-try-this/

The isLargeScreen interupted the postTutorialHelpPopoverIsShown= false value. Henced in the favour of expected behavior removed the ng-if condition.
@shaz13
Copy link
Contributor Author

shaz13 commented Apr 5, 2017

@jaredsilver Thanks for the reference. After going through it realised that the present code was just fine but there was problems if ng-if condition of isLargeScreen as this doesn't change on timeout ng-if Boolean was true hence the popup didn't timeout. The code works fine as expected with removal of ng-if condition and Popup disappears after 5 seconds

@anthkris The popup inherits properties from thirdparty.css and making it dynamic with width is complex until thirdparty.css is modified or !important hack is used. And, travel with the page wasn't included before the PR too. I was wondering if it was intended behaviour as lines here in the codebase allow the popup only if Width >= 1024px

Would 5 second fade off rule will supplement for resizing?
Please, share your thoughts on it

Kindly, review the current commit.

Thanks

Copy link
Contributor

@jaredsilver jaredsilver left a comment

Choose a reason for hiding this comment

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

Thanks a bunch, @shaz13!

I'm pretty happy with this on large screens, but removing the ng-if="ifLargeScreen" seems to mean that the popover will also appear on smaller screens:

screen shot 2017-04-05 at 11 06 57 pm

(See upper right.)

It would be ideal if we could avoid this.

@shaz13
Copy link
Contributor Author

shaz13 commented Apr 6, 2017 via email

shaz13 added 2 commits April 6, 2017 21:23
isLargeScreen condition checked at the function 
 $scope.$on('openPostTutorialHelpPopover', function()
@shaz13
Copy link
Contributor Author

shaz13 commented Apr 6, 2017

@jaredsilver Thought about a CSS fix with media and display:none but as it would make things messy and unproductive adopted the pushed $scope function. Functionality remains same as before for isLargeScreen it is now operated at the directive code rather than inline. Kindly review it

Copy link
Contributor

@jaredsilver jaredsilver left a comment

Choose a reason for hiding this comment

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

Thanks, @shaz13! LGTM from the design side of things!

@jaredsilver
Copy link
Contributor

@kevinlee12 -- could you take a quick look to make sure the code here looks alright?

@kevinlee12 kevinlee12 self-requested a review April 8, 2017 04:53
@kevinlee12
Copy link
Contributor

@jaredsilver, sure!

Copy link
Contributor

@kevinlee12 kevinlee12 left a comment

Choose a reason for hiding this comment

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

Hi @shaz13, I have a minor comment. Once that is addressed, we can merge this.

@@ -38,10 +38,14 @@ oppia.directive('editorNavigation', [function() {
$scope.postTutorialHelpPopoverIsShown = false;

$scope.$on('openPostTutorialHelpPopover', function() {
$scope.postTutorialHelpPopoverIsShown = true;
$timeout(function() {
if ($scope.isLargeScreen) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Move $scope.isLargeScreen above this function, this is so that we can get that defined before this gets a chance to trigger.

Copy link
Member

Choose a reason for hiding this comment

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

Actually -- I think everything gets initialized before anything runs, so the existing code is fine. Does it not trigger on your end?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, on second thought (and trial), it is fine, though it might be better if we shift those variable instantiation higher up for readability's sake.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kevinlee12 openPostTutorialHelpPopover triggers when the user comes to create explorations for the first time.
If adopted this code:

   if ($scope.isLargeScreen) {
            $scope.$on('openPostTutorialHelpPopover', function() {
            $scope.postTutorialHelpPopoverIsShown = true;
            $timeout(function() {
              $scope.postTutorialHelpPopoverIsShown = false;
            }, 5000);
            });
          } else {
            $scope.postTutorialHelpPopoverIsShown = false;
          }

The helptool tip doesnt appear at all. Because, scripts of isLargeScreen execute first and misses openPostTutorialHelpPopover before it could initialize.

Copy link
Contributor

Choose a reason for hiding this comment

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

nope, that's not what I meant. I was speaking of moving line 103 above this function.

Copy link
Contributor

Choose a reason for hiding this comment

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

this line: $scope.isLargeScreen = (windowDimensionsService.getWidth() >= 1024);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kevinlee12 Sure. Will push another commit on it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -81,3 +81,11 @@
{% endif %}
</ul>
</script>
<style type="text/css">
.popover {
Copy link
Member

Choose a reason for hiding this comment

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

This is too broad and needs to be scoped to just this directive.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@seanlip Sure. Could you please look into #1774 ? I am confused with what to push into the CSS after discovering this PR with similar work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PR #3277

Copy link
Member

Choose a reason for hiding this comment

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

That PR has the same mistake. /cc @shivanXI

Copy link
Contributor Author

@shaz13 shaz13 Apr 8, 2017

Choose a reason for hiding this comment

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

@seanlip I was wondering about the merging too. If this PR goes first @shivanXI has to pull the changes before his merge occurs. If his goes first I should pull the changes. Either of one PR must re-write the whole code after merge and pull respective changes , Is it right?

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I don't know, and I can't look into that now, but you're right that if there are conflicts the person whose PR gets merged later must handle them. This is a normal part of shared repository dev workflows so I wouldn't worry too much about it -- but if your PRs overlap then you should coordinate and figure out what to do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@seanlip Sure. Thanks

Copy link
Contributor

Choose a reason for hiding this comment

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

My 2 cents: just proceed with the PR as-is, only because #3277 is now focused on changing the color (which means that PR will have to remove parts where it duplicates work on this PR).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kevinlee12 Sure.

Copy link
Contributor

@kevinlee12 kevinlee12 left a comment

Choose a reason for hiding this comment

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

Hi @shaz13, just the CSS name, once you are done, please assign this PR back to me. thanks!

@@ -81,3 +81,11 @@
{% endif %}
</ul>
</script>
<style type="text/css">
ul .popover.bottom {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is still problematic, can you introduce a new class name that is unique to the popover? What I am saying is to add another class along side dropdown

@shaz13
Copy link
Contributor Author

shaz13 commented Apr 9, 2017 via email

@kevinlee12
Copy link
Contributor

Since we've been changing the focus of the PR's quite a bit, I think we should keep it as is now to prevent further confusion and you've already implemented some of the features:

This PR:

  • Width corrections
  • Popover display duration

PR #3277:

  • Popover color change.

As Sean mentioned, the PR that gets merged later will have to deal with the name changes.

The div is introduce to bring the specificity because popover acts as class itself as well as dropdown is a class too. Hence binding it in div might avoid all future errors.
@shaz13
Copy link
Contributor Author

shaz13 commented Apr 9, 2017

@kevinlee12 Done as suggested. Class is specific now.
The div is introduced in this commit to bring the specificity because popover acts as class (.popover) itself as well as dropdown is a class too. Hence binding it in div might avoid all future errors as these both will be nested under .oppia-help-dropdown class.

Please review the code (assigning it to you)

Copy link
Contributor

@kevinlee12 kevinlee12 left a comment

Choose a reason for hiding this comment

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

Just a nit.

@@ -70,14 +70,24 @@
</li>

{% if username %}
<li ng-if="isLargeScreen" class="dropdown" popover-is-open="postTutorialHelpPopoverIsShown"
<div class="oppia-help-dropdown nav navbar-nav oppia-navbar-nav pull-right ng-cloak">
Copy link
Contributor

Choose a reason for hiding this comment

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

The additional class should be in the line below, not this one. (We're manipulating the popover directly, not this class)

Copy link
Contributor Author

@shaz13 shaz13 Apr 9, 2017

Choose a reason for hiding this comment

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

@kevinlee12 I have tried making changes so, but the alignment and the navbar-nav settings breaks or popover are not functional when adding it to dropdown.
Could you please confirm the changes locally? Or if I misinterpreted could you quote the code snippet for clarity.

Interestingly, popover is acting alike an element here. Modifying it anything else, breaks one or other thing. (nav bar, material icon or the popover itself)

Copy link
Contributor Author

@shaz13 shaz13 Apr 9, 2017

Choose a reason for hiding this comment

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

It gives error if adopt so;
<li class="oppia-help-dropdown dropdown" popover-is-open="postTutorialHelpPopoverIsShown" popover-placement="bottom" popover-trigger="none" popover="To get help in the future, click here!">
As popover is inline with the <li>tag itself

Copy link
Contributor

@kevinlee12 kevinlee12 Apr 9, 2017

Choose a reason for hiding this comment

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

(as mentioned in my other comment), we can keep this placement. I was wondering if you can experiment with oppia-navbar-breadcrumb instead of the CSS you've defined (so that we can get a consistent experience for our users). No need to push, but do report back to this thread. thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

However, you do want to move oppia-help-dropdown to the right of oppia-navbar-nav

Copy link
Contributor Author

@shaz13 shaz13 Apr 9, 2017

Choose a reason for hiding this comment

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

<div class="oppia-help-dropdown nav navbar-nav oppia-navbar-nav pull-right ng-cloak">
to
<div class="nav navbar-nav oppia-navbar-nav oppia-help-dropdown pull-right ng-cloak">
@kevinlee12 This sounds good?

Copy link
Contributor

Choose a reason for hiding this comment

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

yup!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Will push another commit now. Suggesting this 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.

Done

@kevinlee12 kevinlee12 assigned shaz13 and unassigned kevinlee12 Apr 9, 2017
@kevinlee12
Copy link
Contributor

kevinlee12 commented Apr 9, 2017 via email

@shaz13
Copy link
Contributor Author

shaz13 commented Apr 9, 2017

@kevinlee12 Yes, exactly. It doesnt work.

<li class="dropdown oppia-help-dropdown" popover-is-open="postTutorialHelpPopoverIsShown"
          popover-placement="bottom" popover-trigger="none"
          popover="To get help in the future, click here!">

screenshot from 2017-04-09 11-58-24

@kevinlee12
Copy link
Contributor

Hmm, after looking how they implemented the CSS regarding the other popovers, your approach earlier is correct.

@shaz13
Copy link
Contributor Author

shaz13 commented Apr 9, 2017

@kevinlee12 Thanks!. Earlier refers to latest commit or the previous ul .popover class one?

Copy link
Contributor

@kevinlee12 kevinlee12 left a comment

Choose a reason for hiding this comment

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

Nit

@@ -70,14 +70,24 @@
</li>

{% if username %}
<li ng-if="isLargeScreen" class="dropdown" popover-is-open="postTutorialHelpPopoverIsShown"
<div class="oppia-help-dropdown nav navbar-nav oppia-navbar-nav pull-right ng-cloak">
Copy link
Contributor

Choose a reason for hiding this comment

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

However, you do want to move oppia-help-dropdown to the right of oppia-navbar-nav

@kevinlee12
Copy link
Contributor

@shaz13, latest commit that you have on Github (f8a4d88)

@shaz13
Copy link
Contributor Author

shaz13 commented Apr 9, 2017

@kevinlee12 Done. Pushed new commit. Kindly review it

Copy link
Contributor

@kevinlee12 kevinlee12 left a comment

Choose a reason for hiding this comment

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

lgtm!

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

Successfully merging this pull request may close these issues.

6 participants