Skip to content
This repository has been archived by the owner on Oct 11, 2020. It is now read-only.

fix popup width in Edge #103

Merged
merged 1 commit into from
Feb 7, 2018
Merged

Conversation

Hsn723
Copy link

@Hsn723 Hsn723 commented Jan 18, 2018

Should fix #95 and similar issues
Not entirely sure, but I am assuming best practice here is to not touch anything under src/ for platform-specific issues so I placed my changes in platform/edge and reflected them in make-edge.sh.

@nicole-ashley
Copy link
Owner

Thanks @Hsn723!

This appears to fix it when enabling advanced mode, but it causes another issue when disabling it. For some reason the firewall is not hidden in the pop-up UI when you disable it from settings, even though it appears that the .advancedMode class is removed. This behaviour is also present in Chrome (though I'm not sure about the class). I wonder if this is a bug in the core?

Possibly a fix at the moment that still works with the above bug is to remove the .advancedMode class from your change:

body {
  width: 100%;
}

This at least seems to works in Edge in all cases, including when the .advancedMode class is removed but the firewall is still showing.

@gorhill, is the above CSS change something that would be ok in the core repo? Or will it cause issues with other browsers?

@gorhill
Copy link

gorhill commented Jan 29, 2018

will it cause issues with other browsers?

I will have to test to find out. I will do so when I get the time and will notify you if I add this to the core.

@nicole-ashley
Copy link
Owner

Thanks @gorhill!

@Hsn723
Copy link
Author

Hsn723 commented Jan 30, 2018

@nikrolls Whether width: 100% is applied to .advancedUser or simply body should not matter. I figured .advancedUser would be less broad but can change that to body instead if you prefer. I used .advancedUser since I could make that fix Edge specific with minimal effort. To apply this fix on body without applying it on other platforms the build command sed -i 's/body {/body {\n\twidth:100%;/' $DES/css/popup.css needs to be added to make-edge.sh instead which is less elegant.

Also, the additional issue you found is actually not directly related to this fix, since the code for this fix only compiled for the Edge target. That you could repro it in Chrome indicates that it is a separate issue.

Upon investigation, the behavior you describe is actually related to popupData.dfEnabled not being toggled properly when switching from Advanced to Basic.

As the fix for that needs to be done in the ublock.js file this would also affect all platforms. Namely, around line 339:

case 'advancedUserEnabled':
        if ( value === true ) {
            us.dynamicFilteringEnabled = true;
        }
        break;

Needs to be

case 'advancedUserEnabled':
        us.dynamicFilteringEnabled = value;
        break;

In order for the behavior you described not to occur. As this is out of the scope of the current PR and affects all browsers, I could send another PR to the upstream uBO repo for that additional issue.

@nicole-ashley
Copy link
Owner

@Hsn723 What I meant was that because of this issue, applying the CSS fix to only .advancedUser solved one issue but caused another: when you disable advanced mode, the popup goes back to its usual width, but because of the other bug you can only see part of the firewall in it. Therefore a fix that makes Edge work like Chrome currently does is to remove the .advancedUser class from your PR.

Regardless, if it can be made in the core I'm happier with it because I'd prefer not to add more workarounds to the build script.

@Hsn723
Copy link
Author

Hsn723 commented Feb 4, 2018

@nikrolls I see your point. I've removed the .advancedUser class and also included the fix for the other bug since it was a relatively small fix. Let me know if you'd rather keep them separate.

@gorhill
Copy link

gorhill commented Feb 4, 2018

Unfortunately using width: 100%; for body causes an issue in Chromium (and possibly other platforms) when the popup is brought up from within the logger:

a

This also causes a regression for the Firefox/legacy version:

a

I did not test the Firefox for Android version, but I fear this could cause issue as well.

One thing I could do to avoid the sed is to add <link rel="stylesheet" href="css/vapi-popup.css" type="text/css"> to popup.html, and the Edge version could put the fix in there.

@Hsn723
Copy link
Author

Hsn723 commented Feb 4, 2018

@gorhill Thank you, that sounds like a more elegant and future-proof solution than the sed approach. I'll update this PR accordingly once that's available in the upstream.

gorhill added a commit to gorhill/uBlock that referenced this pull request Feb 4, 2018
@nicole-ashley
Copy link
Owner

Thanks @gorhill, I'm happy with that solution if it fits in with your usual strategy for platform-specific overrides.

@nicole-ashley
Copy link
Owner

@Hsn723, we could actually add this ahead of time based on gorhill@f6afd8c. They will probably go out in the same release anyway.

@Hsn723
Copy link
Author

Hsn723 commented Feb 5, 2018

@nikrolls Cool, I've gone ahead and moved things accordingly.

Copy link
Owner

@nicole-ashley nicole-ashley left a comment

Choose a reason for hiding this comment

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

Looks good, just a couple of notes.

src/js/ublock.js Outdated
if ( value === true ) {
us.dynamicFilteringEnabled = true;
}
us.dynamicFilteringEnabled = value;
Copy link
Owner

Choose a reason for hiding this comment

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

We can't make these changes here, they need to be made in the core repository.

cp LICENSE.txt $DES/


Copy link
Owner

Choose a reason for hiding this comment

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

Unnecessary blank line

@@ -21,8 +21,10 @@ cp platform/edge/*.js $DES/js/
cp -R platform/edge/img $DES/
cp platform/edge/*.html $DES/
cp platform/edge/*.json $DES/
cp -R platform/edge/css $DES/
Copy link
Owner

Choose a reason for hiding this comment

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

For consistency with the JS line could this be:

cp -R platform/edge/*.css $DES/css

And then move the vapi-popup.css file to the edge folder.

@@ -0,0 +1,3 @@
body {
width: 100%;
}
Copy link
Owner

Choose a reason for hiding this comment

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

Missing new line at the end of the file 😊

@Hsn723
Copy link
Author

Hsn723 commented Feb 5, 2018

@nikrolls Thanks for the quick review. I've made the requested changes. For the part that affects the core repository I'll submit a separate PR over there.

@lychichem
Copy link

Tested by sideload 1.15.4 plus this fix into Edge. I have to say, the fix do solve the problem, but just partly. The popup will show contents properly. But the popup sometimes still just show the right side with proper content. However, if mouse is hovered on it, the popup will be just okay. So I think this fix is just a workaroud tweak, the true fix to this issue maybe rely on Microsoft.

Copy link
Owner

@nicole-ashley nicole-ashley left a comment

Choose a reason for hiding this comment

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

Thanks @Hsn723! Sorry to be a bother, but do you mind squashing these commits? Especially since there have been a couple of different approaches throughout. Makes the commit history nice and clean. Then I can merge right away!

@nicole-ashley
Copy link
Owner

Thanks @lychichem for giving it a go. I'll run it for a while and see what I come up with as well. The more feedback the better. Which release branch of Windows are you running?

@nicole-ashley nicole-ashley mentioned this pull request Feb 6, 2018
@Hsn723
Copy link
Author

Hsn723 commented Feb 7, 2018

@nikrolls No problem, as requested I've squashed them all into one clean commit.

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.

Menu not visible in Edge if Advanced is enabled
4 participants