Skip to content

Make modal backdrop visible - #735

Merged
sindresorhus merged 10 commits into
masterfrom
visible-backdrop
Oct 28, 2017
Merged

sindresorhus merged 10 commits into
masterfrom
visible-backdrop

Conversation

@fregante

@fregante fregante commented Oct 18, 2017 •

Copy link
Copy Markdown
Member

GitHub's modals have an invisible layer which lets you click anywhere to close. This is invisible, which means that if you open a dropdown and then scroll it out of the view you will lose your first click and won't even know why.

Before

invisible

After

visible

PR test areas

  • Global: Top right, profile dropdown
  • Repo: Watch/Unwatch dropdown
  • Repo: More dropdown
  • PRs: Files changed: Review button dropdown
  • PRs: change PR base dropdown
  • Issues: sidebar reviewers/labels dropdowns
  • Issues: new comment: Insert a reply dropdown
  • Issues list: author/labels/milestones filters
  • Issues list: filter button near search box
  • Homepage: organization dropdown
  • Own profile: contribution settings + jump to dropdown
  • Commits list: verified commits dropdown

Comment thread extension/content.css Outdated

/* Make the modal backdrop visible */
body.menu-active .modal-backdrop,
:root .dropdown-details[open]>summary::before {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Some spacing would be nice: :root .dropdown-details[open] > summary::before {

@sindresorhus

Copy link
Copy Markdown
Member

I don't think the z-index you've set is good enough:

screen shot 2017-10-19 at 23 22 30

@fregante

fregante commented Oct 19, 2017 •

Copy link
Copy Markdown
Member Author

z-index is actually more than enough, but GitHub's own code is overriding it to be 20. Anything above 29 covers both. Needs more work :/

@fregante

fregante commented Oct 20, 2017 •

Copy link
Copy Markdown
Member Author

It looks like their modals are full of bugs that they can't see because the modals are invisible.

In this case there are two backdrops being activated at once: one at document level and one inside the PR bar (which is needed because the whole bar is p:fixed so it's on its own z-index context).

This last commit makes the bug less noticeable by making the PR-bar full-width:

full-width PR

@fregante

fregante commented Oct 20, 2017 •

Copy link
Copy Markdown
Member Author

In the first comment, I added a few more places where I tested this PR.

But not fade out, that requires a bit more code
@hkdobrev

hkdobrev commented Oct 25, 2017 •

Copy link
Copy Markdown
Contributor

@bfred-it Do you think we could make the backdrop a bit less opaque? I'm asking specifically for the review dialogue which is visible in the screenshots above. I often would scroll and look at the code while I write my review comment. I'd like to be able to clearly see the code at that time.

@fregante

Copy link
Copy Markdown
Member Author

You know what, maybe I can. There are two overlapping layers there, that’s why it’s so dark, but I thought of something now.

@fregante

fregante commented Oct 25, 2017 •

Copy link
Copy Markdown
Member Author

I fixed the issue! The second backdrop was only needed to darken the PR bar, so... I forced it to hide only the PR bar. So this now looks as expected.

Before

full-width PR

After

lighter PR view

@hkdobrev hkdobrev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I've approved too soon!

With the latest changes I get this when I open Files changed:

screen shot 2017-10-25 at 10 41 21

After I scroll I get this:

screen shot 2017-10-25 at 10 41 07

Comment thread extension/content.css Outdated
animation: fade-in 0.2s;
}
:root .pagehead ul.pagehead-actions {
position: static; /* Demote watch/start/fork */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

start -> star

@fregante

Copy link
Copy Markdown
Member Author

You're right! I committed the wrong selector. Now it should work

@hkdobrev

hkdobrev commented Oct 26, 2017 •

Copy link
Copy Markdown
Contributor

There's this weird darker area on the right here:

screen shot 2017-10-26 at 20 37 33

Could we get rid of it? 💭

@sindresorhus
sindresorhus merged commit 03a34f4 into master Oct 28, 2017
@sindresorhus
sindresorhus deleted the visible-backdrop branch October 28, 2017 04:34
@sindresorhus

Copy link
Copy Markdown
Member

This is invisible, which means that if you open a dropdown and then scroll it out of the view you will lose your first click and won't even know why.

How about closing the dropdown when the user scrolls it out of view?

@fregante

Copy link
Copy Markdown
Member Author

Can be done via IntersectionObserver. Can you open a new issue?

@sindresorhus

Copy link
Copy Markdown
Member

Yes #778

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants