-1

I'm porting chrome extension to Firefox and I'm testing on Nightly 51a.. version.

When I click the popup options icons it opens and scrollbars appear and after half a second those disappear.

How to correct this?

At the moment I've given a hyperlink in the top in the optins popup with this code which when clicked opens full view html in a new tab and this works just fine:

<a style="font-size:1.5em;" href="options.html" target="_blank">Open Full Window</a>

enter image description here

user5858
  • 1,082
  • 4
  • 39
  • 79
  • Please provide a [mcve] so we can duplicate the problem. – Makyen Aug 20 '16 at 14:25
  • @Makyen it is [this](https://chrome.google.com/webstore/detail/aam-aadmi-tatkal%E0%A4%86%E0%A4%AE-%E0%A4%86%E0%A4%A6%E0%A4%AE%E0%A5%80-%E0%A4%A4/dmlbcokpfajfbkabkeonbekleghkkobp?hl=en) chrome extension – user5858 Aug 20 '16 at 16:33
  • Thanks for the pointer to your extension. ***WOW***, am I glad I [downloaded the source](https://chrome.google.com/webstore/detail/chrome-extension-source-v/jifpbeccnghkjeaalbbjmodiffmgedin) rather than install it. You inject **78 different scripts** into **every** `https:` page (58 target specific banks, but are loaded on *every* page). You also load more scripts into select banking pages. This is both a security issue, and a performance issue. There is no way that you need those loaded on **every** `https` page. They should only be loaded on pages when your extension is actively using them. – Makyen Aug 20 '16 at 23:44

1 Answers1

0

The popup that is being shown for a browser_action is, currently, being set to a maximum of 800x600 pixels (at least in my testing). However, your content is being rendered at a much larger size while having the scroll bars not shown to the user (either not rendered at all, or positioned outside of the view into the document provided by the panel).

There are multiple ways to solve this. However, I was not able to find one that did not result in specifying an explicit height and width for the <body>, or a sub element (e.g. a <div> enclosing all content). Several ways showed the scroll bars, but left them disabled.

The simplest way to get the scroll bars to show up, is to change your HTML from:

<body>

to:

<body style="height:580px;width:800px;">

Obviously, you could also change this in your CSS (banks/options.css). From:

body{
    min-width:500px;
    min-height: 500px;
}

To:

body{
    height: 580px;
    width: 800px;
    min-width: 500px;
    min-height: 500px;
}

However, neither of those allow for the possibility that the panel will be shown with different dimensions (e.g. on other sized screens, or if Firefox changes what it is doing).

Thus, my prefered solution is to use JavaScript. In options.js add something like:

function setBodyHeightWidth(){
    let width=window.innerWidth;
    let height=window.innerHeight;
    height -= 20; //Adjust for Save button and horizontal scroll bar
    //document.body.style.width=width; //Does not work
    //document.body.style.height=height; //Does not work
    document.body.setAttribute('style','height:' + height + 'px;width:' + width + 'px;');
}

function onDOMLoaded(){
    setBodyHeightWidth();
    //Anything else you need to do here.
}

document.addEventListener('DOMContentLoaded', onDOMLoaded);

Using a significantly trimmed down version of the code for your extension (i.e. I removed all your JavaScript, and most of the non-visible HTML), the above code makes it look like:

Scrolling panel

Makyen
  • 31,849
  • 12
  • 86
  • 121
  • Thanks but in the "Other Options" tab to scrollbar is getting cut off. What to do? – user5858 Aug 21 '16 at 07:47
  • @user5858, OK. I will need to re-adjust what I did to strip down your extension. I had taken out the portion that permitted tabs to be switched. It will take me a while to get to it. Today is also already planned to be rather busy with other activities, so it may be late in the day prior to me being able to take a look at it. – Makyen Aug 21 '16 at 14:12
  • @user5858, To navigate your panel requires the JavaScript you have for the page. That JavaScript is obfuscated. I am not going to run it. If you want to provide a version that is not obfuscated, I will consider taking the time to go through it for security issues (required prior to my being willing to use it). A slimmed-down version which just does navigation would be good. I did try displaying just the "Other Options" `tab-pane` and did not experience similar problems. In addition, the question you have asked in your comment is, actually, a different question & should be asked as such. – Makyen Aug 21 '16 at 20:26