Closed Bug 938045 Opened 11 years ago Closed 10 years ago

[Window Management] Implement TextSelectionDiag for Copy&Paste on Firefox OS

Categories

(Firefox OS Graveyard :: Gaia::System::Window Mgmt, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(feature-b2g:2.1)

RESOLVED FIXED
2.0 S4 (20june)
feature-b2g 2.1

People

(Reporter: schien, Assigned: gduan)

References

Details

(Whiteboard: [ft:system-platform])

Attachments

(2 files)

In order to perform copy and paste after selection, we'll need to display a floating bubble widget that contains copy&paste buttons.
First idea:

Would be nice to have some script inside Gaia to enable the floating bubble widget for certain HTML Elements. I'm thinking about a script like the navigator.mozL10n [1]

Something like:

navigator.mozEnableCopyAndPaste(document.querySelector('p'));

This will show a floating bubble widget on all p-Tags.

----

Or Second idea:

The floating bubble widget should be disable-able via css.  Will this work? ->

header * {
   user-select: none;
}

So we can disable the copy-and-paste functionally on UI elements like tabs aso.


[1] https://github.com/mozilla-b2g/gaia/blob/master/shared/js/l10n.js
Assignee: nobody → janjongboom
I'd rather go with the CSS selectors than implement a new non-standard API.
Ok, would be my prefered one too. If this bug has landed, the Gaia Building Blocks [1] should be updated to include the CSS fix.

[1] http://buildingfirefoxos.com/building-blocks/action-menu.html
Keyboard team, please chime in on how this fits with the existing, in-progress work on cursor position (1.3) and text selection and cut/copy/paste for 1.4. How do these things fit together?
Flags: needinfo?(mtsai)
Flags: needinfo?(cawang)
Flags: needinfo?(bhuang)
UX team is working on spec for edit mode after selecting texts. We had floating bubble or change header with edit mode options at the moment. But we are searching for a better approach and welcome any good idea.
Flags: needinfo?(mtsai)
Flags: needinfo?(cawang)
I'd go with a floating bubble, the Android header that we have in FF for Android is so incredibly unclear.
+1 for a floating bubble
(In reply to Stephany Wilkes from comment #4)
> Keyboard team, please chime in on how this fits with the existing,
> in-progress work on cursor position (1.3) and text selection and
> cut/copy/paste for 1.4. How do these things fit together?

This should be part of the copy/paste work, which comes after text selection.  Looking at 1.5 for now, but it's great that this prep work discussion is starting early.
Flags: needinfo?(bhuang)
We already have text selection working in input fields, so it's very useful to start with that in 1.4
Taken for new proposed way to implement this under new window management system.
Assignee: janjongboom → alive
Summary: Implement Copy&Paste widget on Firefox OS → [Window Management] Implement AppSelection for Copy&Paste on Firefox OS
Depends on: 987040
Whiteboard: [ft:system-platform]
feature-b2g: --- → 2.0
Morris I need my device with your WIP gecko patch to work on, thanks.
Flags: needinfo?(mtseng)
We need to find someone to rebase the gaia patch in bug 987040 and add unit tests and put the assets in bug 921965. The layout part will be another bug which is expected to be fixed in stabilization phase but not this week.
^
Flags: needinfo?(mtseng) → needinfo?(timdream)
(In reply to Alive Kuo [:alive][NEEDINFO!] from comment #12)
> We need to find someone to rebase the gaia patch in bug 987040 and add unit
> tests and put the assets in bug 921965. The layout part will be another bug
> which is expected to be fixed in stabilization phase but not this week.

..And I have a device with Morris' gecko patch.
George, would you be able to work with Alive on this?
Flags: needinfo?(timdream) → needinfo?(gduan)
Sure, I'll do what comment 12 said.
Take it first.

(In reply to Tim Guan-tin Chien [:timdream] (MoCo-TPE) (please ni?) from comment #15)
> George, would you be able to work with Alive on this?
Assignee: alive → gduan
Flags: needinfo?(gduan)
blocked by gecko part, move to 2.1
feature-b2g: 2.0 → 2.1
decision made to work concurrently with gecko part browser api. UI and behavior part is not blocked.
WIP:
https://github.com/cctuan/gaia/commit/c04155618b2e593e705d592b2f5d4bb8f6d55185
still working on: 
1. style modification
2. test case for dialog position
Attached file PR to master
Hi Alive,
could you kindly help me to review this patch?
Thanks.
Attachment #8434831 - Flags: review?(alive)
Comment on attachment 8434831 [details] [review]
PR to master

I just found out there're two API issues that cannot meet UX spec.
1. textualmenu event happens everywhere:
   I cannot distinguish whether user click on menu or other text input by current API, so I can't show effect when user put finger on menu and change background color.
2. When click selectAll button, gecko will emit an textualmenu and only have canSelectAll as true, which and then emit another textualmenu with all four items enabled. So, I cannot position dialog in the center of screen immediately when user click selectAll.

I will put some workarounds on gaia.
Attachment #8434831 - Flags: review?(alive)
Hi Morris,
could you take a look at comment 22?
Thanks.
Flags: needinfo?(mtseng)
For item2, the root cause is the mousedown event emit to below content very soon then to trigger a dialog with only canPaste option.
(In reply to George Duan [:gduan] [:喬智] from comment #23)
> Hi Morris,
> could you take a look at comment 22?
> Thanks.
Comment on attachment 8434831 [details] [review]
PR to master

Hi Alive,
could you help me to review it again?
I've put my workaround to prevent paste event be triggered again. But I have no good solution to item2 of comment 22 so far. I will open a bug for it and discuss with Morris.
Attachment #8434831 - Flags: review?(alive)
Comment on attachment 8434831 [details] [review]
PR to master

r+ with nits. Great work! Note the travis is broken in bootstrap and I just rerun it. Be careful to merge.
Attachment #8434831 - Flags: review?(alive) → review+
Offline demo and discussed with Omega from UX.
1. When click selectAll button, sometime a single paste dialog will show before displaying all 4 buttons.
   The reason is textualmenu event with canPaste=true is sent followed by selectall().
   >> We need gecko side to check it.

2. With moving single caret, the dialog cannot show again by clicking the handler.
   >> Known issue from Gecko, need to file a bug for it.

3. The dialog should display while scroll end.
   >> This feature will not be implemented in this state due to gecko limit. We can file a bug if necessary.

4. Carets will interfere url input of browser when the path is too long.
   >> Need a bug to check this issue.
Comment on attachment 8434831 [details] [review]
PR to master

Hi Alive,
could you take a look of my patch again?
I've addressed your opinion and change the dialog position mechanism when selectAll based on UX spec.
Thanks.
Attachment #8434831 - Flags: review+ → review?(alive)
Comment on attachment 8434831 [details] [review]
PR to master

Hi Omega,
as offline discussed and reviewed from you, I've addressed issues as comment 27.
Please let me know if it's suitable or not. Thanks.
Attachment #8434831 - Flags: ui-review?(ofeng)
Comment on attachment 8434831 [details] [review]
PR to master

some nits.
Attachment #8434831 - Flags: review?(alive) → review+
Summary: [Window Management] Implement AppSelection for Copy&Paste on Firefox OS → [Window Management] Implement TextSelectionDiag for Copy&Paste on Firefox OS
Hi George, the patch is r+, and as Comment 27 which is already discussed with UX, please commit the code and resolved fix this bug. Thank you!
(In reply to George Duan [:gduan] [:喬智] from comment #27)
> Offline demo and discussed with Omega from UX.
> 1. When click selectAll button, sometime a single paste dialog will show
> before displaying all 4 buttons.
>    The reason is textualmenu event with canPaste=true is sent followed by
> selectall().
>    >> We need gecko side to check it.
> 
bug 1023037
> 2. With moving single caret, the dialog cannot show again by clicking the
> handler.
>    >> Known issue from Gecko, need to file a bug for it.
> 
bug 1023041
> 3. The dialog should display while scroll end.
>    >> This feature will not be implemented in this state due to gecko limit.
> We can file a bug if necessary.
> 
> 4. Carets will interfere url input of browser when the path is too long.
>    >> Need a bug to check this issue.
It looks like unit tests failed on TBPL

https://tbpl.mozilla.org/?tree=B2g-Inbound&rev=43778d875824
https://tbpl.mozilla.org/php/getParsedLog.php?id=41409812&tree=B2g-Inbound&full=1

George, could you verify and see if we need to back out the patch?
Flags: needinfo?(gduan)
Thanks,
I'll modify my test cases.

back it out now
be1ac200b791c79cb5d072777732c71c2f5593b5
Flags: needinfo?(gduan)
Attached file PR to master 2
This patch has modified layoutManager of unit test to fixed number, so that the test case related to screen position wound not be affected by env.

waiting for result from tbpl gaia-try.
Comment on attachment 8434831 [details] [review]
PR to master

Hi George, here are some feedback:

For current phase:
1. Even a text input has no focus, it should still allow long-press-to-select behavior.
2. When a text input has focus, it can be either long-press on the cursor/handle or other area to select a word.
3. Tapping the handle should show the paste bubble (if there is something in clipboard) *
4. When dragging single handle and then releasing finger, the Paste should appear again. *
5. Dismissing keyboard via long-press-space-bar should also deselect text.
6. Handle touch area should be bigger.
7. Browser address bar:
	1) The original drag-to-select-text behavior should be removed, and keep only drag-to-scroll-text.
	2) "..." should be removed.
	3) Sometimes, long-press-select-word bubble has wrong position.
	4) Sometimes, tap-to-select-all bubble has wrong position.

For next phase:
8. After review, scroll page proposal 2 has some problem if a lot of text is selected. (Please follow Proposal 1.)
9. Long-press on empty space to show only "Select All" (and "Paste" if there is something in clipboard)
10. Paste shortcut won't show automatically after paste once or timeout
Attachment #8434831 - Flags: ui-review?(ofeng) → feedback+
(In reply to Omega Feng [:Omega] from comment #37)
> Comment on attachment 8434831 [details] [review]
> PR to master
> 
> Hi George, here are some feedback:
> 
> For current phase:
> 1. Even a text input has no focus, it should still allow
> long-press-to-select behavior.
Event is triggered only when we focus on input. need gecko's help.

> 2. When a text input has focus, it can be either long-press on the
> cursor/handle or other area to select a word.
Gecko should emit textualmenu event.

> 3. Tapping the handle should show the paste bubble (if there is something in
> clipboard) *
bug 1023041

> 4. When dragging single handle and then releasing finger, the Paste should
> appear again. *
bug 1023041

> 5. Dismissing keyboard via long-press-space-bar should also deselect text.
We should file a bug for it.

> 6. Handle touch area should be bigger.
Need gecko's help.

> 7. Browser address bar:
< Browser issues when copy-paste is enabled >
> 	1) The original drag-to-select-text behavior should be removed, and keep
> only drag-to-scroll-text.
> 	2) "..." should be removed.
> 	3) Sometimes, long-press-select-word bubble has wrong position.
> 	4) Sometimes, tap-to-select-all bubble has wrong position.



> For next phase:
> 8. After review, scroll page proposal 2 has some problem if a lot of text is
> selected. (Please follow Proposal 1.)
We should file another bug for it when we decide to follow proposal 1. (need gecko's help)
Put it as next step.

> 9. Long-press on empty space to show only "Select All" (and "Paste" if there
> is something in clipboard)
Same as 8.

> 10. Paste shortcut won't show automatically after paste once or timeout
??
(In reply to George Duan [:gduan] [:喬智] from comment #36)
> waiting for result from tbpl gaia-try.

You should paste the Try server URL :)
Component: General → Gaia::System::Window Mgmt
Target Milestone: --- → 2.0 S4 (20june)
Resolved, since gaia work for this step has done.

Hi Howie,
as comment 37 and comment 38, we did found a lot of bugs (mostly need gecko's help) which will affect user experience. Should we file more bugs to trace them?
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: needinfo?(hochang)
Resolution: --- → FIXED
Hi George, yes, please fire bugs and put under bug#1023688
Flags: needinfo?(hochang)
Flags: needinfo?(mtseng)
No longer blocks: 747798
Blocks: 1029465
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: