Closed Bug 884890 Opened 11 years ago Closed 11 years ago

[MMS][Multirecipient] Use CSS and touch events for handling the recipients container pull&push effects

Categories

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

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: julienw, Assigned: jugglinmike)

References

Details

(Whiteboard: [comms-triaged])

Attachments

(5 files, 4 obsolete files)

see screenshot

I think the top space is too big when we scroll the recipients down. Moreover if it was a little higher, I think the 3rd line would be entirely displayed.

I understand the margin is there so that when the recipients editor is "closed down", we still can see the bottom of the recipients that are higher. However, we may remove that margin (or rather padding) when the recipients editor is opened, so that we could see 3 full lines, and remove that disgraceful space.

I've found no visual design about this specific issue.

I also think this margin could be removed when there is only one line of recipients, but this is less disgraceful when the editor is smaller.

needinfo on Victoria about this.
Flags: needinfo?(vpg)
Assignee: nobody → waldron.rick
waiting for Victoria's input before reviewing.
The change is one line and I've included screen shots of the resulting UI.
Hi Julien, Rick,

The solution for the particular issue of starting the first recipient higher is good, I think looks much better. 

But I see a bigger bug here that it's not solved, and this is that the recipients field should take the maximum area available to show recipients before scrolling. In the screenshots I see a gap between the recipients field and the input text area despite there are more hidden recipients. The bug is: https://bugzilla.mozilla.org/show_bug.cgi?id=870416

Thanks!
Flags: needinfo?(vpg)
Attachment #764823 - Attachment description: screenshot → before change screenshot
see the 2 new screenshots, I think it's not good enough, maybe the "to:" label should be higher too. We see this on your 3-line screenshot too.

Victoria ?
Hi Julien, 
Please follow the original specs. 
The position of the "To" word is though to fit well in the case when the to field is collapsed and the recipients occupy more than one line, suggesting this can be pulled off and reveal the rest of recipients.

So this is correct: https://bug884890.bugzilla.mozilla.org/attachment.cgi?id=765877
And this : https://bug884890.bugzilla.mozilla.org/attachment.cgi?id=765875 the input text's baseline there should line up with the baseline of the "TO" word.
Thanks a lot Victoria ! I haven't seen your previous comment ;)
(In reply to Victoria Gerchinhoren from comment #5)
> Hi Julien, Rick,
> 
> The solution for the particular issue of starting the first recipient higher
> is good, I think looks much better. 
> 
> But I see a bigger bug here that it's not solved, and this is that the
> recipients field should take the maximum area available to show recipients
> before scrolling. In the screenshots I see a gap between the recipients
> field and the input text area despite there are more hidden recipients. The
> bug is: https://bugzilla.mozilla.org/show_bug.cgi?id=870416

Bug 870416 has a patch pending review.
From what I can tell, the screenshots of the changes are correct? 

FWIW, Neither of them illustrates the actual fix this bug addresses.
Rick, the screenshots clearly illustrate changes that the fix makes ;) You can see easily with the "j" character that without your patch, it's properly aligned, whereas with your patch, it's slightly up. That's what Victoria is confirming in comment 9.

I don't know if that's fixable using only CSS, but maybe you can ask Mike for some help if necessary.
Glad someone can tell, I sure can't. Either way, it's a shame about that j, someone else should take it from here.
Mike, do you feel like tackling this ?
Flags: needinfo?(mike)
Based on Comment 11 (and after confirming with Julien on IRC), I'm marking this bug as dependent on Bug 870416. Once that lands, I'll get to work on a new patch.
Depends on: 870416
Flags: needinfo?(mike)
Assignee: waldron.rick → mike
Comment on attachment 764911 [details] [review]
Github Pull Request https://github.com/mozilla-b2g/gaia/pull/10493

removing the r request in the mean time
Attachment #764911 - Flags: review?(felash)
This patch is not ready for review (see the bug described in the commit message). I'm uploading it to track my progress
As we know this should not block leo, but JS logic for the recipients-panel is dangerous (we are adding a lot of JS, and should be CSS instead with only a little bit of JS tracking the touch events), so I would like to see this fixed and working as it's defined in the wireframes & visual. Nominating to koi?
blocking-b2g: --- → koi?
The bug title is probably wrong now that we're actually opening the recipients panel in the available space.
Julien, in master this is not working as expected (we need only to take the space needed by the recipients, and the max-height is the max available in the screen without the header). Furthermore the touch events are not working as expected (you should be able to pull/push without pulling the entire panel down) etc.... a lot of things to fix, but we could wait till KOI
(In reply to Borja Salguero [:borjasalguero] from comment #21)
> Julien, in master this is not working as expected (we need only to take the
> space needed by the recipients,

Mmm I checked the spec lately (because it looked wrong to me as well) and it seemed to be what's implemented right now, but I may be wrong.

Just checked it again and it's not clear enough: it's not explained what should be done if the recipients list does not fill all the available space (slide 19, 6th panel).


Anyway, then this bug should be retitled and probably Mike's patch should be obsolete, right ?
Flags: needinfo?(aymanmaat)
I think so. However this is one of the things that we could discuss with Ayman in Paris during the WW, and have a clear idea about the things to be implemented.
Summary: [sms] we're scrolling the recipients too low → [sms] Use CSS and touch events for handling the recipients container pull&push effects
Summary: [sms] Use CSS and touch events for handling the recipients container pull&push effects → [MMS][Multirecipient] Use CSS and touch events for handling the recipients container pull&push effects
ok lets discuses during WW Paris. in the mean time i wont do anything with this.
Julien, Borja - let me know if that is not ok for you.
(In reply to Borja Salguero [:borjasalguero] from comment #19)
> As we know this should not block leo, but JS logic for the recipients-panel
> is dangerous (we are adding a lot of JS, and should be CSS instead with only
> a little bit of JS tracking the touch events), so I would like to see this
> fixed and working as it's defined in the wireframes & visual. Nominating to
> koi?

Originally there was very little JS logic at all—only what was needed for handling the "pull" gesture. This is still the case, however now there is a significant amount of JS that must calculate and recalculate the available space. The operation that does the (re)calculation is _completely_ decoupled from the actual "pull down" mechanism (which means this bug's new title is incorrect).
Stepping off of this bug to focus on higher-priority Messaging work
Assignee: mike → nobody
Assignee: nobody → waldron.rick
Whiteboard: [comms-triaged]
> Just checked it again and it's not clear enough: it's not explained what should be done if the recipients list does not fill all the available space (slide 19, 6th panel).

So I discussed with Ayman and here is how it should behave:

* the bottom border of the panel should be adjacent to the top border of the one-line message input. However, if the message input has several lines, then the bottom border of the panel should still stop at the (now virtual) top border of a one-line message input. That means it would effectively hide the top part of the several-line input. And that the max-height of the recipients panel is fixed for a screen height (of course it will change whether the keyboard is displayed or hidden).

* ideally the recipients panel should open to show the recipients and only the recipients. That means there should not be a blank space.

Is it clear for you Rick ?
Flags: needinfo?(aymanmaat)
Julian, 

It looks like the pull down is broken _again_. This is the second time it's been negligently broken since the code for it landed. I will track down the issue and report back. Once I know more about that issue, I will respond to your notes
Checking in... I'm bisecting back from my commit that fixed this the first time it broke.
Attached patch Bug-884890-partial.patch (obsolete) — Splinter Review
In comment 28, Rick identified a regression relating to the behavior of the Recipients list pull down. He correctly attributed that regression to a change that I made in resolving Bug 875362. This patch is my attempt to correct this regression.

I've also created a branch on GitHub in order to facilitate discussion on my approach:

https://github.com/jugglinmike/gaia/compare/mozilla-b2g:c5a589e...jugglinmike:884890-recipients-list
Attachment #788303 - Flags: feedback?(waldron.rick)
Attached patch Bug-884890.patch (obsolete) — Splinter Review
Thanks to Rick's feedback (on IRC), we were able to promote the previous regression patch into a complete bug fix. (I've updated the GitHub pull request to match)
Attachment #788303 - Attachment is obsolete: true
Attachment #788303 - Flags: feedback?(waldron.rick)
Attachment #788377 - Flags: review?(waldron.rick)
Attachment #788377 - Flags: review?(gnarf37)
Assignee: waldron.rick → mike
I'm really pleased with the solution that Mike and I were able to produce and I want to thank Mike for taking the whole day to work through this issue. 

I will address Julien's notes below, but first I made an assumption based on the second starred item: and that is that the pulldown should only open _fully_ if there so many recipients that the list will scroll.

(In reply to Julien Wajsberg [:julienw] from comment #27)
> > Just checked it again and it's not clear enough: it's not explained what should be done if the recipients list does not fill all the available space (slide 19, 6th panel).
> 
> So I discussed with Ayman and here is how it should behave:
> 
> * the bottom border of the panel should be adjacent to the top border of the
> one-line message input. 

Confirmed.

> However, if the message input has several lines,
> then the bottom border of the panel should still stop at the (now virtual)
> top border of a one-line message input. 

Confirmed.

> That means it would effectively hide
> the top part of the several-line input. 

Confirmed.

> And that the max-height of the
> recipients panel is fixed for a screen height (of course it will change
> whether the keyboard is displayed or hidden).

Confirmed.

> 
> * ideally the recipients panel should open to show the recipients and only
> the recipients. That means there should not be a blank space.

Confirmed.


All of these points are addressed in the patch that Mike attached.
Attachment #788377 - Flags: review?(waldron.rick) → review+
Comment on attachment 788377 [details] [diff] [review]
Bug-884890.patch

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

I haven't tried it on the device (corey: please do ;) ) but this looks good to me. I especially love the simplification of this.

::: apps/sms/js/thread_ui.js
@@ +2130,5 @@
>    index = generateHeightRule.index || sheet.cssRules.length;
>    tmpl = generateHeightRule.tmpl || Utils.Template('height-rule-tmpl');
>  
>    css = tmpl.interpolate({
> +    height: String(height)

is the "String" explicit coercion really necessary here ?
Attachment #788377 - Flags: feedback+
(In reply to Julien Wajsberg [:julienw] from comment #33)
> Comment on attachment 788377 [details] [diff] [review]
> Bug-884890.patch
> 
> Review of attachment 788377 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> I haven't tried it on the device (corey: please do ;) ) but this looks good
> to me. I especially love the simplification of this.
> 
> ::: apps/sms/js/thread_ui.js
> @@ +2130,5 @@
> >    index = generateHeightRule.index || sheet.cssRules.length;
> >    tmpl = generateHeightRule.tmpl || Utils.Template('height-rule-tmpl');
> >  
> >    css = tmpl.interpolate({
> > +    height: String(height)
> 
> is the "String" explicit coercion really necessary here ?

Yes, Utils.Template.prototype.interpolate only allows string values (this has always been the case)
Attached patch Bug-884890-v2.patch (obsolete) — Splinter Review
I just realized that Julien is a more appropriate reviewer for this patch since he's been working with Rick on this bug and has familiarity with it. This new patch includes his handle in the commit message (and I've updated the pull request on GitHub to match).

Sorry for the noise, Corey!
Attachment #788377 - Attachment is obsolete: true
Attachment #788377 - Flags: review?(gnarf37)
Attachment #788971 - Flags: review?(felash)
Attachment #768568 - Attachment is obsolete: true
Comment on attachment 788971 [details] [diff] [review]
Bug-884890-v2.patch

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

bug 1:
* have a multiline recipient
* tap on the recipient panel as to add a new recipient => it should be slid up
* slide it down
* press backspace
=> it's slid up again, but you can't slide it down unless you first focus the composer input

Bug 2:
* have a 2-line recipients panel
* slide it down => you have the keyboard
* tap the grey space in the middle => the keyboard hides
=> the bottom "padding" grows, which is a bug imho
=> maybe we should slide up the panel in that case ?

Bug 3:
* slide down the panel
* tap inside it to add a new recipient
=> it's slid up, whereas I think it should stay slid down in that case.

Bug 4:
* tap inside the panel
* slide down the panel
* type something
=> it's slid up, whereas I think it should stay slid down in that case too.

Comments:
* I'd like to somehow align the left border of the recipient boxes with the cursor (when it's at the start of a new line)
* I would decrease a little (2 px ?) the top and bottom "padding" in multiline mode

::: apps/sms/js/thread_ui.js
@@ +2127,5 @@
>    }
>  
>    sheet = generateHeightRule.sheet || sheets[sheets.length - 1];
>    index = generateHeightRule.index || sheet.cssRules.length;
>    tmpl = generateHeightRule.tmpl || Utils.Template('height-rule-tmpl');

could this template use max-height instead of height ?

and then you could just set the height to "natural". Or maybe not fix the height at all, and let CSS do its magic ?

Also, just to be sure: are we injecting CSS so that we don't have a synchronous reflow but a interruptible reflow instead ? Therefore would it make sense to put the composer input max height in that template as well ?
Attachment #788971 - Flags: review?(felash)
Ayman, could you please give your advice about the Bug 3 and Bug 4 in my comment 36 ? I mean, are there expected behaviour, or are there bugs ?
Flags: needinfo?(aymanmaat)
Hey Julien,

Thanks as always for the thorough review. I'm going to have to take some time with each of the bugs you mentioned but regarding the `height` suggestions:

(In reply to Julien Wajsberg [:julienw] from comment #36)
> ::: apps/sms/js/thread_ui.js
> @@ +2127,5 @@
> >    }
> >  
> >    sheet = generateHeightRule.sheet || sheets[sheets.length - 1];
> >    index = generateHeightRule.index || sheet.cssRules.length;
> >    tmpl = generateHeightRule.tmpl || Utils.Template('height-rule-tmpl');
> 
> could this template use max-height instead of height ?
> 
> and then you could just set the height to "natural". Or maybe not fix the
> height at all, and let CSS do its magic ?
> 
> Also, just to be sure: are we injecting CSS so that we don't have a
> synchronous reflow but a interruptible reflow instead ? Therefore would it
> make sense to put the composer input max height in that template as well ?

We need to explicitly set `height` (i.e. not rely on `height: auto;` and/or set `max-height`) so that the Recipients element animates as it transitions between `singleline` and `multiline` mode.
(In reply to Mike Pennisi [:jugglinmike] from comment #38)

> We need to explicitly set `height` (i.e. not rely on `height: auto;` and/or
> set `max-height`) so that the Recipients element animates as it transitions
> between `singleline` and `multiline` mode.

Tell me if I'm wrong here, but since we only open the panel to contain the recipients now, couldn't a transform: translate work fine here (if not better, would probably be smoother), using translate(-100%) for example ?
That's an interesting idea, Julien! It will definitely perform better, but it may take a little more refactoring.

The document layout will not respond to changes in an element's `transform` property, and right now, we are relying on the change in the `messages-recipients-list` height to effect the height of the containing `messages-to-field`. We may be able to get around this by instead animating the `transform` of the `messages-to-field`--we'll just need to set a fixed position for the "To:" label and the "Add contact" button.

In my experience, removing elements from the document flow leads to less maintainable code. I will investigate this approach and report back on what it could mean for maintainability.
Note that we can move forward with this bug that is quite ready and do the transform experiment in another bug. But now is a good time to experiment with this imho.
(In reply to Julien Wajsberg [:julienw] from comment #36)
> Comment on attachment 788971 [details] [diff] [review]
> Bug-884890-v2.patch
> 
> Review of attachment 788971 [details] [diff] [review]:
> -----------------------------------------------------------------
 
> Bug 3:
> * slide down the panel
> * tap inside it to add a new recipient
> => it's slid up, whereas I think it should stay slid down in that case.

referencing 
wireframe pack: HTML5_SMS-MMSUserStorySpecifications_20130503_V8.0
page: 19
frame 7: Closing the to field

The ‘to’ field is closed be the user:
1) typing on the keyboard when the focus is still on the ‘to’ field
2) tapping on the ‘your message’ textfield and so changing focus
to the ‘your message field’

…so this is behaving as specified, but i would say that the current transition makes it feel awkward. 


> Bug 4:
> * tap inside the panel
> * slide down the panel
> * type something
> => it's slid up, whereas I think it should stay slid down in that case too.

…so this is behaving as specified.
Flags: needinfo?(aymanmaat)
Thanks Ayman. And just to be clear, you still do think that the specified behavior is good here ?
(In reply to Julien Wajsberg [:julienw] from comment #43)
> Thanks Ayman. And just to be clear, you still do think that the specified
> behavior is good here ?

From a UX PoV it is not a deal breaker if the user pulls down on the 'to' field, starts to type in the 'to' field and the 'to' field stays open ...in fact seeing it in action it would probably be a better UX than is specified if it did stay open because the end user has visibility of a greater number of recipients - thus their cognitive load is lowered - and their activity focus is addition of recipients if they continue to type in the to field.  

All i can say is that what has been implemented is what i specified. So the developer has not deviated. However if we have bandwidth to alter the specified behavior and it does not bring any risk to the app i am happy to underwrite a change in the UX so that the 'to' field stays 'open' when the user types into it... let me know what you plan to do
That's 1.2 work so I'm ok with taking some time to do it better for the user :)
Hi Julien,

Yesterday, I was able to reproduce "bug 1" on `master`. Today, I can't reproduce it on `master` *or* with this patch applied. Could you verify that the bug still exists with this patch and not on the latest `master` branch?

This patch addresses "bug 2" through `box-sizing: border-box;`.

It sounds like "bug 3" and "bug 4" are both specified behavior, so I have not made any changes to address them.
Attachment #788971 - Attachment is obsolete: true
Attachment #789671 - Flags: review?(felash)
Comment on attachment 789671 [details] [diff] [review]
Bug-884890-v3.patch

Somehow I missed comment 44 and comment 45. I will work on a new patch that implements the new pulldown functionality.
Attachment #789671 - Flags: review?(felash)
(In reply to Julien Wajsberg [:julienw] from comment #45)
> That's 1.2 work so I'm ok with taking some time to do it better for the user
> :)

ok, i was thinking this over lastnight. We should do this as it is an improvement to the UX but one thing we need to bear in mind is that in doing it we are removing a mechanism to close the opened 'to' field. This puts more 'pressure', shall we say, on creating an affordance/easily selectable touch area to drag the 'to' field up in order to close it. I would therefore suggest that when the to field is open we leave more of a gap between the underside of the last contact module at the bottom of the list of recipients and the bottom edge of the 'to' field. This would give a greater target area and also reduce the risk of user scrolling the list of recipients instead of closing the 'to' field when it is open.

...we might therefore require also a little visual design input. What do you think Julien?
Flags: needinfo?(felash)
Ayman, we just agreed with Mike that this would be done in another bug, I'll file it and answer you there.
Flags: needinfo?(felash)
Blocks: 905169
Comment on attachment 789671 [details] [diff] [review]
Bug-884890-v3.patch

Re-requesting review on this bug based on an IRC discussion with Julien. Implementation of the new pull-down behavior will be tracked in bug 905169
Attachment #789671 - Flags: review?(felash)
(In reply to Julien Wajsberg [:julienw] from comment #49)
> Ayman, we just agreed with Mike that this would be done in another bug, I'll
> file it and answer you there.

good stuff.
Comment on attachment 789671 [details] [diff] [review]
Bug-884890-v3.patch

r=me

if you can do a test without changing the app code, it's good, otherwise just land it.

Thanks !
Attachment #789671 - Flags: review?(felash) → review+
Filed bug 905169 for the specification changes, bug 905260 for some padding changes, and Mike will file a bug for using max-height and transformations.
Blocks: 905273
Landed on `master` at commit 79e0d142dc6ea6741d37d593ebb639299f827275

Thanks for the help, Julien and Rick!
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
clear the koi? flag. it's already landed on master
blocking-b2g: koi? → ---
Attachment mime type: text/plain → text/x-github-pull-request
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: