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

When Modal Overlays are layered, only bottom layer has a dark background (fix #4808) #4820

Merged
merged 1 commit into from
Dec 7, 2016

Conversation

willy-b
Copy link
Contributor

@willy-b willy-b commented Oct 15, 2016

Test Plan:

  1. Open Brave, navigate to Preferences->Payments tab
  2. Enable Payments
  3. Click "Advanced Settings"
  4. Observe background (page outside modal) is darkened.
  5. Click "Backup Wallet"
  6. Observe background does not get darker.

@bbondy
Copy link
Member

bbondy commented Oct 18, 2016

Could you provide before / after screenshots?

@willy-b
Copy link
Contributor Author

willy-b commented Oct 26, 2016

@bbondy, yep!

Before:
brave_issue_4808_before

After:
brave_issue_4808_after

@luixxiul luixxiul added the design A design change, especially one which needs input from the design team. label Oct 27, 2016
@luixxiul
Copy link
Contributor

Viewing the code I think setting background:none to .modal + .modal is simpler.

@willy-b
Copy link
Contributor Author

willy-b commented Nov 23, 2016

@luixxiul agree. I just tested this and replaced my commit in this PR with your solution by force-push.

@bsclifton
Copy link
Member

bsclifton commented Nov 26, 2016

@willy-b One slight problem with this PR (sorry it hadn't been looked at before ☹️)

If the top level modal is smaller than the previous one / ones, you can see that they aren't being grayed out.
screen shot 2016-11-26 at 12 27 44 am

In this case, I had to hack the DOM to get this showing... but if the child window is smaller, this would be a problem. I simulated this by cracking open the dev tools and removing the main content div from the "recover your wallet" page

@willy-b
Copy link
Contributor Author

willy-b commented Nov 27, 2016

good catch. looking into this now

@willy-b
Copy link
Contributor Author

willy-b commented Nov 28, 2016

hey @bsclifton, after trying a bunch of CSS-only solutions, I fixed this by adding some logic to keep track of all the ModalOverlay instances and ensure only the top-most one has a last class which gives it a dark background. If you can recommend a CSS-only way, please do.

It's a little trickier than it looks (:last-child , :last-of-type won't work here since modal/non-modal divs are mixed together as siblings). Still seems like there should be a simple opposite of .modal + .modal { background: transparent } (which successfully ensures only the first modal has a dark background) that would work for ensuring the last modal would have a dark background here, but I couldn't find it.

@luixxiul
Copy link
Contributor

If div[class^="modal"]:last-of-type could work, that would be the best solution, but it doesn't.

@bsclifton
Copy link
Member

@willy-b it does look good for Advanced settings... but unfortunately, if you go to the Add funds screen and then hit either the QR code or the add with debit/credit (assuming those show up for you), they'll either have a missing overlay or a super dark overlay ☹️

screen shot 2016-11-28 at 4 13 46 pm

screen shot 2016-11-28 at 4 14 02 pm

@willy-b
Copy link
Contributor Author

willy-b commented Nov 29, 2016

@bsclifton: there is now only one modal background in view for all cases and the QR popup background is styled correctly.

the background for the Coinbase iframe modal is still a bit darker because the background is actually from Coinbase's site which uses a darker gray. not sure what the best approach there is, feel free to advise!

@bsclifton
Copy link
Member

@willy-b sorry it's taken me a few days to get back to you; I tried this out...\

  • overlay looks great between pages 😄
  • unfortunately, there is a flicker when going from add funds to the buy widget. Can you update this to keep the overlay (which would make it even darker?) That would prevent this flash

Regarding the iframe styles, the coloring is in the body tag for the buy widget. You might be able to select it with document.querySelectAll() and then update the object returned's style attribute (removing background-color or replacing with transparent).

@bsclifton bsclifton added this to the 0.13.1 milestone Dec 2, 2016
@willy-b
Copy link
Contributor Author

willy-b commented Dec 4, 2016

Hey @bsclifton, I made the change you asked for, but I just noticed @luixxiul has some changes on the way that may obsolete this (see #6009 (comment)).

@luixxiul you're fixing #4808 in PR #6009 then?

@willy-b
Copy link
Contributor Author

willy-b commented Dec 4, 2016

Didn't mean to step on your toes @luixxiul, didn't see your changes.

@luixxiul
Copy link
Contributor

luixxiul commented Dec 4, 2016

@willy-b No, I cannot find a solution by myself. Please go ahead :-)

@luixxiul luixxiul mentioned this pull request Dec 4, 2016
4 tasks
@willy-b
Copy link
Contributor Author

willy-b commented Dec 4, 2016

@willy-b
Copy link
Contributor Author

willy-b commented Dec 4, 2016

This looks fixed in your screenshots, let's close this PR.

@willy-b
Copy link
Contributor Author

willy-b commented Dec 4, 2016

OK, I just tested your commit @luixxiul https://github.com/luixxiul/browser-laptop/commit/2327e9eca53eb4a637dd4c3e3a2a1d1f613c2fbc#commitcomment-19937858 , and it looks perfect for the recovery dialog. The QR code popup still has a double overlay, which is not present in this PR, but I'm sure you can fix that too. The results are otherwise identical and your solution is MUCH cleaner (all CSS/LESS). You guys (@bsclifton, @luixxiul) make the call. Thanks!

@bsclifton
Copy link
Member

@willy-b how about let's just keep this on the back-burner until @luixxiul's PR is accepted and then we'll revisit?

@luixxiul
Copy link
Contributor

luixxiul commented Dec 4, 2016

@willy-b I have been trying CSS solution too but couldn't find the solution. I thnk it doesn't solve the issue found by @bsclifton here above: #4820 (comment)

@bsclifton
Copy link
Member

bsclifton commented Dec 6, 2016

OK awesome; @luixxiul's PR has been accepted. @willy-b, can you rebase?

I think you're safe to own this change (the darkening of the modal issue) since you had already started this with a PR. Your last commit that I tested was working great, but we just needed to tune the behavior with regards to the buy widget... choosing either to:

  • Keep the overlay and let it darken extra dark (and possibly creating an issue to track fixing that)
  • Keeping the overlay but then putting a style over the iframe body style, making background transparent (for the buy widget)

- tried several CSS-only solutions for ensuring only the top-most modal had a gray background,
  but I think using some JS is actually simpler, so that is what I did here

- keeping modalOverlay background when opening iframe w/ Coinbase widget
  (decision made w/ @bsclifton after trying alternatives)

fixes #4808
@willy-b
Copy link
Contributor Author

willy-b commented Dec 7, 2016

Hey @bsclifton, thanks again for reviewing. I pushed a commit implementing the first option (keeping the overlay for the Coinbase iframe) 4 days ago and force-pushed a rebase of that here just now.

(in case anyone wants to check something, I kept the old/pre-rebase branch at https://github.com/willy-b/browser-laptop/tree/issue-4808-old)

@bsclifton
Copy link
Member

bsclifton commented Dec 7, 2016

Great job! This looks and feels great 😄

@cezaraugusto, wanna give it a go?

@cezaraugusto
Copy link
Contributor

++!! looks awesome, great work!

@cezaraugusto cezaraugusto merged commit 2728303 into brave:master Dec 7, 2016
@luixxiul luixxiul modified the milestones: 0.13.0, 0.13.1 Dec 7, 2016
@luixxiul
Copy link
Contributor

luixxiul commented Dec 8, 2016

@willy-b Hi Willy, is it possible to add .last unless the modal contains .coinbaseOverlay? The iframe inside .coinbaseOverlay itself has the dark background.

@bsclifton
Copy link
Member

@luixxiul would you be able to open a separate issue for that? I think it's possible, but would be good to track separately 😄

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
design A design change, especially one which needs input from the design team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

background color of modal window on ledger advanced settings gets darker by clicking backup wallet button
5 participants