Search Issue Tracker

By Design

Votes

0

Found in

2023.2.19f1

6000.0.0b15

Issue ID

UUM-69920

Regression

Yes

TextField cannot be edited in an extended Editor window when double-clicking it

--

-

How to reproduce:
1. Open the “UIR2022.3.24“ project
2. Open the “UIRTest” window (Window > UI Toolkit > UIRTest)
3. Double-click on the “EDIT ME PLEASE” text

Expected result: A text box is displayed
Actual result: Nothing happens

Reproduced with: 2023.2.0a6, 2023.2.19f1, 6000.0.0b15
Not reproduced with: 2021.3.37f1, 2022.3.25f1, 2023.2.0a5

Reproduced on: macOS 14.4.1 (M1) (by reporter), Windows 11
Not reproduced on: No other environment tested

  1. Resolution Note:

    Starting in 2023.2 and going forward, Pointer events and their corresponding Mouse events are propagated at the same time. This simplifies the workflow and helps migrating from mouse to pointer events, which are more flexible and the recommended way to handle all pointer types.

    A consequence of this simplification is that the MouseDownEvent is now received by its target *before* the focus is modified. When the MouseDownEvent callback calls Focus() on an element, that focus is very quickly replaced by the target of the MouseDownEvent. This behavior is exactly matching the behavior of the PointerDownEvent in 2022.3 and earlier, which is what Unity is aiming for.

    This problem can be fixed by adding
    {code:c#}rootVisualElement.focusController.IgnoreEvent(e);{code} to the MouseDownEvent callback method after e.StopPropagation():

    {code:c#}
    private void OnMouseDownEvent(PointerDownEvent e) {
    if (e.clickCount != 2)
    return;
    FocusTitleEditor();
    e.StopPropagation();
    rootVisualElement.focusController.IgnoreEvent(e);
    }
    {code}

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.