Closed Bug 950767 Opened 11 years ago Closed 9 years ago

e.me input box should fade as homescreen transitions out of view

Categories

(Firefox OS Graveyard :: Gaia::Homescreen, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: dietrich, Unassigned)

References

Details

(Whiteboard: [lang=js])

Attachments

(1 file, 1 obsolete file)

currently it's a bit visually clunky to see the blunt edge of the input box move out of view as you swipe to the homescreen to the right.

instead, as the default homescreen slides out of view, the input box should fade away or fade up or explode into in a cloud of magic fairy dust.

or some kind of neat effect.
Blocks: 950786
YES! <3 <3 <3

Have you made a patch? I can help you get it landed :D
Whiteboard: [mentor=dietrich][lang=js]
No, Frankly I made hacky solution just to see how it will look like. I am total noob in codebase and I wasn't sure how to do it properly. There so many layers of abstraction ... oh ... I will ask questions!
Thanks Aleksandr, that's awesome. If you put your code up somewhere, I would be glad to help you shape it into something we can get into Firefox OS!
For example: the only place where I can do something during panning is `handleEvent` function. But this stuff is not aware of any content of any page. So it's clear I can't just add stuff like `var progress = Math.abs(deltaX) / Math.abs(windowWidthMinusOne); ev.opacity = 1 - progress;` inside it =) It would be cool if each page was instance of some class. In this case I could call/trigger some methods of currently panned pages inside this `handleEvent`. Method like 'pannedProgress`. And if any of the Page implementations need to do anything on this event, it can implement these callbacks. Such Page would be the first one, that has special thingy (search input) that it would change opacity of.
Second option is if Grid thingy itself would emit events like 'panning', 'stopPaning' etc and if Page needed it could listen for those events and do something with it's content.

But as I see Page "class" is generic class, and it initialized just with DOM element.

So, these are my thoughts so far.

I think I will look around the code a bit more. Maybe I will see the structure a bit more and understand where to put everything. But at some point I will push my stuff to my fork and let you know.
One more option is to make a css class like 'fade-in-out-able' and when transition happens, find all the elements with this class on currently moved pages and do magic dust on them.
This is general solution and I don't know if there will be any other element like this.
Oh! Cool. I found that grid and everything.me.js are coupled together with 'gridpageshowend' 'gridpagehideend' events. Will investigate this.
Cc Etienne, who's done lots of work in this area of homescreen, can offer suggestions.
Flags: needinfo?(etienne)
Cc UX for review and input on this change.
Flags: needinfo?(firefoxos-ux-bugzilla)
Ok. I found nicest solution. It's very late outside, so I will put patch here, tomorrow I will do pull-request (or how it should be done better?)
Also there is TODO, which I will finish tomorrow, but main idea behind solution is there to evaluate by Etienne.
Attached patch transWithFade.patch (obsolete) — Splinter Review
Comment on attachment 8393193 [details] [diff] [review]
transWithFade.patch

Review of attachment 8393193 [details] [diff] [review]:
-----------------------------------------------------------------

Nice! I like the approach :)

Tips: you should modify apps/homescreen/everything.me/css/everything.me.css so that the #activationIcon always has
```
  transition: opacity;
  will-change: opacity;

```
applied to it for better performances [1].

[1] more about this on bug 940842.

PS: we'll eventually have to send this patch to a homescreen peer (I actually never touched the homescreen code ;p), but let's make sure it's buttery smooth first :)

::: apps/homescreen/js/grid.js
@@ -395,5 @@
>      removePanHandler();
> -  }
> -
> -  function onPanningProgress(nextPage, progress) {
> -    pages[nextPage].container.dispatchEvent(new CustomEvent('gridpagepanning', {'detail': {'progress': progress}}));

nit: no need for the quotes.
|{detail: {progress: ...|

::: apps/homescreen/everything.me/js/everything.me.js
@@ -578,5 @@
>      return false;
>    },
>    onHide: function onHide() {
> -    var activationIcon = document.getElementById('evme-activation-icon');
> -    activationIcon.style.MozTransition = 'opacity 300ms ease';

nit: we unprefixed MozTransition, you can do |style.transition| now :)

@@ -586,5 @@
> -  },
> -  onStopPanning: function onStopPanning(visibility) {
> -    // TODO Move content of onHide and onShow to this place and it should be
> -    // triggered right before final transition animation starts (when mouse release in the middle of panning)
> -    // because right now final appear started only when page already in place

exactly, and you should bubble the duration left in this event so we can make sure our transition duration here is exactly the same.
Attachment #8393193 - Flags: feedback+
Flags: needinfo?(etienne)
Thank you. Will do all the stuff later today. 

MozTransition and MozTransformation is all over the place (in those files at least) I guess it should be refactored also by someone. And I left quotes because I didn't know that I need to have 'detail' property in this object, and it didn't work first without it. So I saw how it done in other place (with quotes) and left it so, thinking maybe there is some magic that requires it. =)

I haven't heard about  "will-change:" before at all. Will investigate.
Some suggestions before reviewing Vivien and/or me (homescreen) and Ran(ev.me):

This kind of nice improvements implies better UX but worst performance because we are including more allocations in the panning code so I would like to say

1) This effect is just for the first page so please try to do it only when the first and second pages are involved. So we won't penalize to the rest of pages

2) Save the reference to document.getElementById('evme-activation-icon')

3) Some year ago we had opacity changes in the homescreen so you could follow this code in order to reach a good performance thought

https://github.com/mozilla-b2g/gaia/commit/0a2a2de0259de70a4a3b0762be4a46a3ab7cd9e2
Thank you. 2) - sure it was just to up and running. 1) - Will it affect performance if you trigger event on an object where no handlers are attached? 3) Will look it through.
(In reply to Aleksandr Motsjonov from comment #15)
> Thank you. 2) - sure it was just to up and running. 1) - Will it affect
> performance if you trigger event on an object where no handlers are
> attached? 3) Will look it through.

Yes, for sure, you are accessing to DOM, calculating an absolute value, dividing numbers and creating new objects as parameters in detail
Flags: a11y-review?
Flags: a11y-review?
Please review my pull-request
Flags: needinfo?(etienne)
Flagging Josh on homescreen.
Flags: needinfo?(firefoxos-ux-bugzilla) → needinfo?(jcarpenter)
Attached file Gaia PR
You can paste github URLs directly as attachment.
I'm forwarding the review to Christian who is a homescreen peer.
Attachment #8393193 - Attachment is obsolete: true
Attachment #8394907 - Flags: review?(crdlc)
Flags: needinfo?(etienne)
Attachment #8394907 - Flags: review?(ran)
Attachment #8394907 - Flags: review?(crdlc)
Comment on attachment 8394907 [details]
Gaia PR

Please after addressing/answering comments on Github, request me again for a review, thanks a lot and good job
Attachment #8394907 - Flags: review?(crdlc)
Hey Aleksander, thanks for the PR and efforts. The code looks solid but there are 2 scenarios that should be discussed:
1. When Evme is loaded, the activation-icon is replaced with the real Evme searchbar (#search-header). So currently, after clicking the searchbar, the effect doesn't happen anymore.
2. When Evme results are displayed. I don't know if the effect is required when swiping then off screen.
Ran, Thx. I will see what I can do. Will show my solution with next commits.
Aleksandr, I can take over the Evme code for this feature. I just want to know what's required cause it's a bit complex.
Actually I started making this part as well. What I did is extracted element that have to be faded into EverythingME object itself. And when icon changed to actual field or when it's opened with keyboard (black box with autocomplete line under it) I change this element reference to currently exposed element. 

So, when addGridPageHandlers -> changeActivationIconOpacity has been called (swiping in progress) then it uses that element.

The only problem I encountered right now is that "#evmeContainer #header" right now already has "transition: all .2s linear;" And when I change opacity it does it with transition (when finger still moves screen). I was thinking of adding "in-transition" class to the main pages holder (container variable in GridManager) And in CSS I could cancel "all" transition.

I can show what I have and you will help me polish it?
Actually I started making this part as well. What I did is extracted element that have to be faded into EverythingME object itself. And when icon changed to actual field or when it's opened with keyboard (black box with autocomplete line under it) I change this element reference to currently exposed element. 

So, when addGridPageHandlers -> changeActivationIconOpacity has been called (swiping in progress) then it uses that element.

The only problem I encountered right now is that "#evmeContainer #header" right now already has "transition: all .2s linear;" And when I change opacity it does it with transition (when finger still moves screen). I was thinking of adding "in-transition" class to the main pages holder (container variable in GridManager) And in CSS I could cancel "all" transition.

I can show what I have and you will help me polish it?
Ran, please check out my latest commits.
Ran, do you have any ETA on looking at these changes?
Flags: needinfo?(ran)
Aleksander, your transition suggestions works for me.
Can you rebase the branch?
Flags: needinfo?(ran)
Rebase what branch where? My branch up to date with current master?
Flags: needinfo?(ran)
You're right! There is a major change to this file in 1.3T.

Can't make the keyboard come up for some reason.. brb
Flags: needinfo?(ran)
LGTM. Amir can you do a quick review of this?
Attachment #8394907 - Flags: review?(ran)
Attachment #8394907 - Flags: review+
Attachment #8394907 - Flags: feedback?(amirn)
Comment on attachment 8394907 [details]
Gaia PR

f+

Aleksandr, please rebase master and note:
1. a reference to EverythingMe.gridPage was added (https://github.com/mozilla-b2g/gaia/commit/7b64b34f)

2. you will have a conflict in |initEvme| with commit https://github.com/mozilla-b2g/gaia/commit/ccc91448

see my comments on GH

thanks
Attachment #8394907 - Flags: feedback?(amirn) → feedback+
Mentor: dietrich
Whiteboard: [mentor=dietrich][lang=js] → [lang=js]
Mentor: dietrich
Is this bug still valid now that Rocketbar and new Homescreen are default?
This ticket is irrelevant since v2.0.
Removing flag on old bug. Resolving invalid per comment #36. It's bug cleaning day in my world.
Status: NEW → RESOLVED
Closed: 9 years ago
Flags: needinfo?(jcarpenter)
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: