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

Notification Bar Changes #6939

Merged
merged 1 commit into from
Apr 20, 2017
Merged

Notification Bar Changes #6939

merged 1 commit into from
Apr 20, 2017

Conversation

jonathansampson
Copy link
Collaborator

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).

Auditors: @bradleyrichter

Resolves #6935

@jonathansampson jonathansampson added the design A design change, especially one which needs input from the design team. label Jan 31, 2017
@jonathansampson jonathansampson added this to the 0.13.2 milestone Jan 31, 2017
@@ -7,7 +7,19 @@

.notificationBar {
display: inline-block;
position: relative;
z-index: 1000;
Copy link
Contributor

@luixxiul luixxiul Jan 31, 2017

Choose a reason for hiding this comment

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

I'd replace this with @zindexNavigationBar according to

@zindexNavigationBar: 2000;

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@luixxiul That appears to cause the type of problems we faced in the design discussion last night. Namely, interacting with some of the document elements will cause the shadow to vanish; often only regions of it will vanish.

odd-shadow

Copy link
Contributor

Choose a reason for hiding this comment

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

How about changing @zindexNavigationBar on variables.less into 1000 then??

@bsclifton
Copy link
Member

@jonathansampson is this one ready for review? If not, can we move it to 0.13.3? thanks 😄

@jonathansampson
Copy link
Collaborator Author

@bsclifton I'm not positive; @bradleyrichter, thoughts?

@bradleyrichter
Copy link
Contributor

I thought we were stuck at the lame-triangle problem? Did you find a solution @jonathansampson ?

@jonathansampson
Copy link
Collaborator Author

@bradleyrichter I'm looking into some of the tab-change, window-resize events now to see if we can just subscribe to those and pick up the needed information to position the triangle. Positioning it will require us to use a true element, rather than a pseudo element.

@bbondy bbondy modified the milestones: 0.13.3, 0.13.2 Feb 1, 2017
@bbondy bbondy removed this from the 0.13.5 milestone Feb 16, 2017
@cezaraugusto cezaraugusto self-assigned this Feb 23, 2017
@cezaraugusto
Copy link
Contributor

I have a fix for triangle issue and going to self-assign this and make a follow-up of @jonathansampson changes.

@cezaraugusto
Copy link
Contributor

@jonathansampson I edited PR with caret feel free to edit anything. Didn't test all use cases for app-wise notifications, tried only fullscreen

@jonathansampson
Copy link
Collaborator Author

jonathansampson commented Mar 15, 2017

@cezaraugusto Wonder if we should be concerned with the following scenario: A user has multiple tabs opened, and may confuse the notification on one for being a notification on another. Note below how the notification bars for github.io appear to be coming from google.com.

image

Another question is can a user change the favicon to appear as though it has a triangle in it, thus making the spoofing more persuasive to many users. We may want to get @diracdeltas' input here as well.

imageimage

@diracdeltas
Copy link
Member

@jonathansampson the problem with having the notification bars fully in the webview area is that a page can spoof them; this is why initially i implemented them to be above the tab bar. this is solved by having the triangle poke into the "trusted UI" area, but yeah i agree it's confusing to have it point to a different tab. IMO it should always point to either the URL bar or the tab where the notification is coming from.

@bradleyrichter
Copy link
Contributor

bradleyrichter commented Mar 15, 2017 via email

@cezaraugusto
Copy link
Contributor

yes that's my fault, didn't test for more than one alert. I'll do an update.

To avoid spoofing we can move the caret to the close button instead of favicon, so we can back to safe UI area. When tab is small enough to remove close icon we could also remove the caret.

/cc @jonathansampson @bradleyrichter @diracdeltas

@diracdeltas
Copy link
Member

@bradleyrichter i don't know what you mean. the notifications right now appear in the ("global") trusted UI area, but they only appear when the tab they are for is active.

@cezaraugusto as long as the caret isn't going to an unrelated tab, sgtm

@bsclifton
Copy link
Member

@cezaraugusto if the notifications are per-tab, you'll also be able to close this issue out 😄 #7737

@jonathansampson
Copy link
Collaborator Author

jonathansampson commented Mar 15, 2017

image

@bradleyrichter @diracdeltas In the above screenshot, Google.com has a notification bar. I left it untouched, and moved over to webrtc.github.io, where two additional notification bars were opened. Each bar points only to its related tab. But triangles are visible even when associated notification bars are not.

@cezaraugusto I would suggest placing the triangle in the center of the tab rather than on the left or right. Should we also hide the triangle if the tab isn't focused? Or, perhaps mark tabs in such a manner so as to show that they have a pending notification? Something other than the triangle for blurred tabs?

@diracdeltas
Copy link
Member

@jonathansampson i see, i didn't realize there was a notification for the goog tab. in that case seems like the triangle for google should just disappear (or turn grey)

@cezaraugusto
Copy link
Contributor

edited, now caret only appears if tab is active and has a notificationBar. Also moved caret to the center.

hasTabInFullScreen={
sortedFrames
.map((frame) => frame.get('isFullScreen'))
.some(fullScreenMode => fullScreenMode === true)
}
/>
{
this.props.appState.get('notifications') && this.props.appState.get('notifications').size && activeFrame
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We call out to this.props.appState.get('notifications') 3-4 times. Can we do this once, and then store the result?

Copy link
Contributor

@cezaraugusto cezaraugusto Mar 16, 2017

Choose a reason for hiding this comment

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

you mean adding to a variable? If so, we can:

const notifications = this.props.appState.get('notifications')
const hasNotifications = notifications && notifications.size
...
hasNotifications && activeFrame
  ? <NotificationBar notifications={notifications} activeFrame={activeFrame} />
  : null

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@cezaraugusto Yes. This way we only have to go searching for the object once.

@bradleyrichter
Copy link
Contributor

bradleyrichter commented Mar 16, 2017 via email

@luixxiul
Copy link
Contributor

I'm just wondering, if we really need the caret over the tab title. I can easily imagine a bunch of users would say, "please add an option to hide it or just remove it because I want to read the full title".

For me the aim of the caret is unclear, because, if I select a tab and there appears a notification bar under the tab, it is obvious that the notification bar appears there exactly for the tab which I selected just now.

Also, in this case, if the tab preview is enabled, the notification bar should be hidden if another tab is previewed which do not have notification.

@diracdeltas
Copy link
Member

The caret is needed because otherwise a notification bar can be spoofed by a malicious page.

@diracdeltas
Copy link
Member

The way chrome/ff handle this is by having a notification box pop up from the URL bar when the tab it is for is in focus. That would be better.

@cezaraugusto
Copy link
Contributor

I'm ok either way change it to be nested to urlbar should be minimal

@cezaraugusto
Copy link
Contributor

@bradleyrichter ok to use it the same way as Chrome/FF?

@bradleyrichter
Copy link
Contributor

I am not sure this would work because it would cover all of the other tabs, forcing the user to interact with the message before using other tabs?

@bradleyrichter
Copy link
Contributor

Let's try adding a border and making the nub more defined and obvious.

@bsclifton
Copy link
Member

How's this one looking? @jonathansampson, @cezaraugusto, @luixxiul

@jonathansampson
Copy link
Collaborator Author

jonathansampson commented Apr 19, 2017

@bsclifton I'm assuming it's ready to go since @cezaraugusto added PR/ready-for-review a day ago. @bradleyrichter, how do you feel about the present presentation?

@@ -115,6 +116,14 @@ class NotificationBar extends ImmutableComponent {
}
}

class NotificationBarCaret extends ImmutableComponent {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this component? I don't see real benefit of having it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@NejcZdovc What do you suggest as an alternative?

Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure if we need component for two divs. What I would suggest is to create divs where we now use this component and move styles into notificationStyle file and use it from there.
cc @cezaraugusto

Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer this way because then I can leave styles on the component itself. Otherwise, I'll have to create a new style for that and put it on the tab itself or inside a third file, and if I do it then I'm not taking advantage of Aphrodite.

Style and component should live together so I don't have to run several files to find a simple thing. Things we do such as commonStyles.js is just a hack we found to keep refactoring important stuff while common components aren't ready yet/too nested. Having both together makes regressions less likely.

It also simplifies the code, so if for some reason Brad or other less code-experienced member/collaborator wants to change something for a given component, they'll need to go to into just one file.

@bradleyrichter
Copy link
Contributor

I'm happy now. Let's merge and refine the styles separately as @NejcZdovc suggested.

@cezaraugusto
Copy link
Contributor

Based on latest Brad's spec:

screen shot 2017-04-20 at 1 04 20 am

@cezaraugusto cezaraugusto force-pushed the notification-bar branch 3 times, most recently from fe72678 to e5ecc26 Compare April 20, 2017 04:46
@cezaraugusto cezaraugusto merged commit 1d8588d into master Apr 20, 2017
@cezaraugusto cezaraugusto deleted the notification-bar branch April 20, 2017 06:40
@jonathansampson
Copy link
Collaborator Author

@cezaraugusto Holy smokes, that's gorgeous! :)

@NejcZdovc NejcZdovc added this to the 0.15.1 milestone Apr 20, 2017
@srirambv
Copy link
Collaborator

srirambv commented May 2, 2017

Nub not shown for pinned tabs
image

Also notification for pinned tabs is retained accross normal tabs as well. This is on packaged 0.15.2 packaged preview 1 build

@bradleyrichter
Copy link
Contributor

bradleyrichter commented May 2, 2017 via email

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.

9 participants