GithubHelp home page GithubHelp logo

mozilla / side-view Goto Github PK

View Code? Open in Web Editor NEW
174.0 22.0 35.0 775 KB

An experiment with opening mobile views of pages in the sidebar

License: Mozilla Public License 2.0

JavaScript 58.01% HTML 12.30% CSS 29.69%

side-view's Introduction

Side View

An experiment with opening mobile views of pages in the sidebar.

Install from addons.mozilla.org

Installing

Use npm install, then npm start.

Installing manually

Check out the repository. Go to about:debugging in Firefox, and select Load Temporary Add-on. Select a file in the addon/ directory.

Or: install web-ext (like npm i -g web-ext) and run web-ext run -s addon/ --browser-console -f nightly

Using

This adds a context menu item: Open in sidebar or Open link in sidebar. Select that, and the sidebar will be opened with a mobile view of the page.

Credits

Anthony_f's Sidebar for Google Search inspired this add-on's approach.

side-view's People

Contributors

clouserw avatar fzzzy avatar htwyford avatar ianb avatar johngruen avatar mozilla-github-standards avatar pdehaan avatar rohanthacker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

side-view's Issues

Localize

Presumably we'd use Pontoon and a similar build approach to Screenshots (though we don't currently have any build process)

Keep sidebar tab list updating live

The sidebar fetches the list of tabs when you go home, but doesn't keep it updated. Maybe we can listen for the important events in sidebar.js? background.js doesn't have as good an idea of when the tab list is displaying.

Close sidebar if it's open when clicking browserAction

This is a followup to #23.

This might be hard, because sidebar.open() is supposed to be called in response to a user action. Which means any async calls before calling that could cause trouble.

Maybe we could do this by always calling open (no await!), but then immediately send a message to the sidebar asking if it is open, and if it is, then call close.

Content-Security-Policy can block pages

Use can use CSP to block framing a site. testpilot.firefox.com is an example, with frame-ancestors 'self'

Unfortunately modifying the request via the add-on does not affect the CSP :(

Note we can definitely read the CSP header, and detect that there will be a problem.

Hide browser UI when in homepage

Right now the browser UI (back, reload, iframe, etc) is off-screen to the right when you are on the homepage, but it is still visible. You can identify this by tabbing, which will cause that UI to scroll back into focus.

Note this is part of #27

Setup different kinds of builds

We need to have dev and production builds (at least to support GA as in #30). Maybe using NODE_ENV? We'll have to write that to some file that the add-on can read (e.g., in Screenshots we create build/buildSettings.js).

Decide on User-Agent

There's a couple at the top of background.js. This is what Vivaldi uses:

Mozilla/5.0 (Linux; Android 6.0.1; SM-G920F Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.170 Mobile Safari/537.36 Vivaldi/1.95.1077.50

Google Analytics snippet

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-77033033-7"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-77033033-7');
</script>

Create package.json

We should have a package.json file. Most of our "build" steps (ideally all?) should just be npm run scripts.

The Feedback button wrongly overlaps the "Current tabs" list when the window is vertically resized

[Affected versions]:

  • Firefox 58.0.2 and up
  • Tab Split 2 0.2.0

[Affected Platforms]:

  • All Windows
  • All Mac
  • All Linux

[Prerequisites]:

  • Have a clean Firefox profile with the latest Tab Split 2 v0.2.0 installed.
  • Have at least 4 tabs open.
  • Have Tab Split sidebar open.

[Steps to reproduce]:

  1. Open Firefox browser with the profile from prerequisites.
  2. Vertically resize the window until "Recent Splits" section is not visible.
  3. Scroll down and observe the right bottom of the sidebar.

[Expected result]:

  • The "Feedback" button is displayed.

[Actual result]:

  • The "Feedback" button overlaps the "Current Tabs" list.

[Notes]:

  • This issue is reproducible if you diagonally resize the window or if you resize the sidebar to its minimum width.
  • Also, when you hover the "Feedback" button, it is partially visible.
  • Here is a screen recording with this issue:
    tab split 2 - feedback icon

Warn about CSP-blocked pages

Per #33, some pages won't work in iframes. We can still detect this, in the same code that we use to fix X-Frame-Options.

I propose:

  • We detect X-Frame-Options
  • We send a message with the URL affected to the sidebar when we see this
  • The sidebar additionally checks that the URL being loaded is the affected URL, and in that case it removes the iframe and replaces it with a warning message (or maybe redirects the iframe to a warning page). This additional check is because the code that reads the header might catch requests that aren't coming from the sidebar.

Note Bug 1318532 would fix this for us (by allowing us to use <iframe mozbrowser>), so it's not necessarily a permanent flaw in our approach (but it can't be fixed for launch).

Add eslint rules

Should borrow the setup/configuration from some other package.

The website is wrongly blank and the "Home" button becomes unusable if you press the "Tab" key after you return to the Homepage UI

[Affected versions]:

  • Firefox 58.0.2 and up
  • Tab Split 2 0.2.0

[Affected Platforms]:

  • All Windows
  • All Linux

[Prerequisites]:

  • Have a clean Firefox profile with the latest Tab Split 2 v0.2.0 installed.
  • Have the Tab Split sidebar open.

[Steps to reproduce]:

  1. Open Firefox browser with the profile from prerequisites and navigate to a website.
  2. Click the tab from the "Current Tabs" list.
  3. Press the "Home" sidebar's button.
  4. Click the "Tab" key and press again the "Home" button.

[Expected result]:

  • The homepage UI is displayed.

[Actual result]:

  • Nothing happens and the website remains blank.

[Notes]:

  • This issue is still reproducible if you click the "Refresh" button.
  • Here is a screen recording with this issue:
    tab split 2 - home button and blank website

Create browserAction

I.e., a toolbar button. This would be the same as "open tab in sidebar". It's primarily for increased visibility.

If the sidebar is open to Tab Split, then the sidebar should be closed. See Bug 1427431 for some more info. Closing may not be easy.

The "Current Tabs" list does not update accordingly when a tab is closed

[Affected versions]:

  • Firefox 58.0.2 and up
  • Tab Split 2 0.2.0

[Affected Platforms]:

  • All Windows
  • All Mac
  • All Linux

[Prerequisites]:

  • Have a clean Firefox profile with the latest Tab Split 2 v0.2.0 installed.
  • Have at least 2 tabs open.
  • Have Tab Split sidebar open.

[Steps to reproduce]:

  1. Open Firefox browser with the profile from prerequisites.
  2. Close one tab and observe the "Current Tabs" list.

[Expected result]:

  • The closed tab is no longer displayed in the list.

[Actual result]:

  • The previously closed tab is still displayed.

[Notes]:

  • The list updates only after another action is performed, such as closing another tab, open another tab or refreshing the window.
  • Here is a screen recording with this issue:
    tab split 2 - current tabs list

Create onboarding

Needs design. This would be on the sidebar homepage, and should be dismissable.

Move *.tmpl files into addon/?

Per #56 (comment)

@ianb says: "It's a little odd to me that manifest.json.tmpl is in the root, and I'd probably want to just put it in addon/, but for now I copied that approach and we can discuss it later. (If it went in addon/, then we'd want to use web-ext build --ignore-files '*.tmpl')"

@pdehaan says: "Sorry, I went w/ putting it in the root because I didn't want it to get bundled into the add-on when running web-ext build. I totally forgot they added the --ignore-files flag."

Get an icon

The sidebar wants an icon, as will the browserAction

Make it work in multiple windows

While the sidebar is opened in the "current" window, the message that is sent goes to all sidebars. Additionally, when opening a new sidebar in a new window, the retry code stops retrying as soon as it contacts any sidebar, which could be a sidebar in an unintended window.

It might help if we set the URL to sidebar.html#url={url_to_open} instead of using the messaging.

Review accessibility

  • All buttons and links should have visible focus states
  • All buttons and links should be accessible via keyed entry (tab selection)
  • All form elements should include appropriate label attributes
  • All grouped buttons should be nested in a and described with a legend
  • All UI should be verified to use A11y friendly contrast ratios

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.