New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 856609 link

Starred by 6 users

Issue metadata

Status: Fixed
Owner:
Closed: Aug 2
Cc:
Components:
EstimatedDays: ----
NextAction: 2018-08-01
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

[Mac-views]: Text selection is seen on opening context menu in omnibox

Project Member Reported by sindhu.chelamcherla@chromium.org, Jun 26 2018

Issue description

Chrome Version: 69.0.3472.0
OS:  MacOS 10.13.3

Pre-condition: Enable #views-browser-windows flag from chrome://flags

What steps will reproduce the problem?
(1) Open any page, say chrome://version
(2) place cursor at end of line, open context menu and observe 

Expected: No text should be selected on opening context menu.
Actual: Instead last word is seen selected. Attaching screencast for reference.

This issue is seen from introduction from introduction of flag in M-67.

Thanks!
 
Macviews_omnibox selection.mp4
1.1 MB View Download
Cc: robliao@chromium.org
robliao@, can you triage / assign appropriately?
Status: Available (was: Untriaged)
Triage: This one possibly requires turning off the left click handler in this case. Keeping P2/Available per MacViews triage.
Labels: -M-69 Group-Focus_Input_Selection_Activation_KeyState
Labels: M-69
Labels: -Pri-2 ReleaseBlock-Stable Pri-1
Owner: ellyjo...@chromium.org
Status: Assigned (was: Available)
Cc: a...@chromium.org
Labels: Needs-TestConfirmation
Is this still an issue?

avi@ made a change to propagate mouse events correctly to our webui.
This has nothing to do with mouse event propagation.

For whatever reason, our current omnibox in Cocoa doesn't select a word when right-clicked, while the new MacViews omnibox does.

What's interesting is that while our omnibox matches Safari, in general, right-clicking on the Mac force-selects what's under the mouse.

I would hardly call this a P1 and would argue that perhaps it's worth keeping. In any case, it's not worth stressing over.
Labels: -Pri-1 -Needs-TestConfirmation Pri-2
I think some wires got crossed in triage - this isn't the bug that comment was meant to go to :)
#7: I don't see the described behavior in Safari's omnibox - right-clicking in the omnibox is not selecting the word under the mouse. Maybe this is a setting?
Elly, what you see is what I saw; I wasn't super clear in comment 7. In trying to clarify, I found that the Mac behavior is suuuuper subtle.

Try in TextEdit to right-click with no selection. What happens is:
- If you're really close to the insertion point, the context menu comes up with no selection.
- If you're not super close to the insertion point, the word under the mouse pointer is highlighted and you get the context menu.

We only do the second part in Chrome for web page contents. (I was unaware of the subtlety of the first part.)

As for the omnibox, our Cocoa behavior is:
- If the omnibox is not selected, a right-click selects it all
- If the omnibox has an insertion point, a right-click doesn't change it
- If the omnibox has a selection, a right-click doesn't change it
- If the right click is off the right side, don't change the selection

Note that this doesn't match Cocoa text field behavior.

Safari's omnibox behavior is:
- If the omnibox has an insertion point, follow Cocoa rules of not changing the selection if the click is near the insertion point, but if the click is far away then rather than selecting a segment, select the whole thing

Which doesn't match Cocoa text field behavior either.

Our new Omnibox behavior is:
- Always select the word under the cursor on a right click
- If the right click is past the right edge, select the rightmost word

That last bit is a change from how we behave now. OTOH, no omnibox implementation matches the Cocoa implementation so I don't this is anything to worry about.
Okay. The last bit bugs me since it makes it impossible to right-click paste at the end of the omnibox, so I'll own fixing this, but this is not a super important bug.
I looked some at this - the buggy code is here:

  if (event.IsOnlyRightMouseButton()) {
    if (PlatformStyle::kSelectAllOnRightClickWhenUnfocused &&
        initial_focus_state == InitialFocusStateOnMousePress::UNFOCUSED) {
      SelectAll();
    } else if (PlatformStyle::kSelectWordOnRightClick &&
               !render_text->IsPointInSelection(event.location())) {
***   SelectWord(event.location());
    }
  }

I'll work on a fix shortly.
Friendly ping to get an update as it is marked as RB stable.
Thanks..!
Labels: -ReleaseBlock-Stable
NextAction: 2018-08-01
Not RBS.
The NextAction date has arrived: 2018-08-01
Project Member

Comment 16 by bugdroid1@chromium.org, Aug 1

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/81b25d40014a645ae83431b721776e5de94b7163

commit 81b25d40014a645ae83431b721776e5de94b7163
Author: Elly Fong-Jones <ellyjones@chromium.org>
Date: Wed Aug 01 15:53:00 2018

views: add SelectionController test coverage

This change is in preparation for a fix to the right-click selection behavior
on Mac.

This change also has RenderTextHarfBuzz EnsureLayout() when getting a substring
range.

Bug:  856609 
Change-Id: I85c81c630fc2e6ac79d01a7a25a6f3e30756fdb5
Reviewed-on: https://chromium-review.googlesource.com/1156844
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: Michael Wasserman <msw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579820}
[modify] https://crrev.com/81b25d40014a645ae83431b721776e5de94b7163/ui/gfx/render_text_harfbuzz.cc
[modify] https://crrev.com/81b25d40014a645ae83431b721776e5de94b7163/ui/views/BUILD.gn
[add] https://crrev.com/81b25d40014a645ae83431b721776e5de94b7163/ui/views/selection_controller_unittest.cc

Project Member

Comment 18 by bugdroid1@chromium.org, Aug 2

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e5e5b5a3ffa29b462afe41a0d7489c07f9b3f7c5

commit e5e5b5a3ffa29b462afe41a0d7489c07f9b3f7c5
Author: Elly Fong-Jones <ellyjones@chromium.org>
Date: Thu Aug 02 18:33:50 2018

macviews: don't select words on right-clicks outside text bounds

This matches the behavior of Cocoa textfields, and also makes it possible to
right-click paste at the end of a textfield.

Bug:  856609 
Change-Id: Ic609b2bb78737d379e7e0a57ab3f4c7f16a3cec9
Reviewed-on: https://chromium-review.googlesource.com/1160768
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: Michael Wasserman <msw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580260}
[modify] https://crrev.com/e5e5b5a3ffa29b462afe41a0d7489c07f9b3f7c5/ui/views/selection_controller.cc
[modify] https://crrev.com/e5e5b5a3ffa29b462afe41a0d7489c07f9b3f7c5/ui/views/selection_controller.h
[modify] https://crrev.com/e5e5b5a3ffa29b462afe41a0d7489c07f9b3f7c5/ui/views/selection_controller_unittest.cc

Status: Fixed (was: Started)
This is Fixed now, but I'm not going to merge it to M69.
 Issue 890338  has been merged into this issue.

Sign in to add a comment