Search Unity

Bug TextField selection highlight broken (2021.2.0b7)

Discussion in 'UI Toolkit' started by pawelduda, Aug 18, 2021.

  1. pawelduda

    pawelduda

    Joined:
    Feb 1, 2019
    Posts:
    45
    When selecting text in TextField selection and caret are invisible.

    This is text box with full text selected. Caret is invisible and only small blue box is shown. This partial selection is only visible when first letter is selected.
    upload_2021-8-18_11-59-43.png

    If first letter is not selected, then nothing is visible. On image below word text is selected.
    upload_2021-8-18_12-1-36.png

    Is there a quick fix for this? Or a way to turn off text selection?
     
    Nexer8 likes this.
  2. pawelduda

    pawelduda

    Joined:
    Feb 1, 2019
    Posts:
    45
    @JuliaP_Unity @antoine-unity @benoitd_unity Do you guys have any idea on this? How to fix it or disable? Or is fix for it coming any time soon?

    Case for this is already opened (1357418) but noone answered to it...
     
  3. perholmes

    perholmes

    Joined:
    Dec 29, 2017
    Posts:
    296
    Confirmed here as well. Found this thread after trying to debug this for several days.

    The selection highlight is simply not shown, but the logic behaves as though the selection was there, so you can select and then type to replace it. The selection highlight is just never shown.

    Also, the cursor doesn't blink.

    Updated to 2021.2.0b11, and it's still the same.
     
  4. Nexer8

    Nexer8

    Joined:
    Dec 10, 2017
    Posts:
    271
    It is fixed in 2022.0a7
     
  5. perholmes

    perholmes

    Joined:
    Dec 29, 2017
    Posts:
    296
    Is 2022.0a7 generally ahead feature-wise, or is it also behind 2021 betas in any regards? I'd worry that features in 2021 betas aren't immediately available in 2022 alphas.

    And why is a bug fix like this appearing in 2022 alphas and not the 2021 betas where all other UI Elements updates seem to happen?
     
    Last edited: Sep 13, 2021
  6. Nexer8

    Nexer8

    Joined:
    Dec 10, 2017
    Posts:
    271
    2022 alphas should have all the features of the betas + more. The reason this fix happens in 2022.0a7 is because the 2022 versions are focused on a rewrite of the TextFields. Backporting this would still be nice though.
     
  7. perholmes

    perholmes

    Joined:
    Dec 29, 2017
    Posts:
    296
    Yeah, the bummer about that is that where 2021 is inching towards being production ready -- and we have an app to release -- 2022 alphas are far more risky to release anything with. Granted, this is a small app and problems with using either alphas or betas can be completely known. But releasability gets kicked far back if 2022 is the only option.

    Effectively, if you use text fields at all, the entire 2021 branch is dead. It delays by a year the time that someone can responsibly release an app using UI Elements, all because of a single bug. That's a big hammer.
     
    Nexer8 likes this.
  8. perholmes

    perholmes

    Joined:
    Dec 29, 2017
    Posts:
    296
    Trying 2021.a7, it does sort of fix the selection, but this is apparently going to be a rough ride, because the TextField keeps being released with obvious issues.

    * In alpha 7, double-click on a word is broken. You have to click elsewhere and suddenly the double-click takes effect. Same for triple-click.

    * A dragged selection is misaligned with the text, so that you have to have dragged all the way across character B until character A gets selected.

    * The cursor still doesn't blink.

    It's not that you can't survive these issue. But they are an indicator that the person programming this isn't normally a UI programmer and doesn't spot such issues. Speaking from experience.
     
    Nexer8 likes this.
  9. perholmes

    perholmes

    Joined:
    Dec 29, 2017
    Posts:
    296
    UPDATE: The button alignments are caused by old line-feeds present in the markup that are now parsed in 2022 Alpha 7.

    Also, button text layout is broken in alpha 7. All of the following buttons have identical configuration. I've been unable to find any USS difference between them spending all morning on it. I'm going to give up and implement a button from scratch so I can move on.

    upload_2021-9-13_12-37-41.png

    I generally find that I can't use Unity's controls because there's always some part of it that can't be controlled. So I've been implementing sliders and checkboxes and scrollviews from scratch so I can get them to behave. All of my own controls ran without issue in Alpha 7, which also reinforces that if I'm going to be on bleeding edge release, it's bad to also use Unity controls. I'll probably only use TextField, and everything else will be custom.

    Also, Alpha 7 comes with compatibility issues with other packages, and I strongly object to putting a critical TextField update into a very future release. You've killed UI Elements for most users for another year. Most users won't be able to jump onto a future Alpha, and they won't be able to use UI Elements in any 2021 beta or release. So I think it's a bit suicidal of the UI Elements team. Absolutely terrible decision.
     
    Last edited: Sep 13, 2021
  10. Nexer8

    Nexer8

    Joined:
    Dec 10, 2017
    Posts:
    271
    I too ended up implementing all of the controls myself. One thing is changing the styles, which always becomes a problem because of some obscure style that is applied after my inline c# styles. Another problem is the lack of customizability in terms of layout and all of the default values I would have to override. TextFields and Labels will be the only Unity made elements I will use, and hopefully they will work.
     
    perholmes likes this.
  11. perholmes

    perholmes

    Joined:
    Dec 29, 2017
    Posts:
    296
    In a plot twist, the misaligned buttons were something else. My markup had line-breaks, which were likely created by a very old version of UI Builder. I only hand-code markup now and wouldn't add line feeds in button on purpose. Buttons now seem to be multiline, so they came into effect.

    upload_2021-9-13_15-11-10.png

    This is likely an old bug that's long since fixed. Just documenting it in case it helps someone.
     
  12. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    In terms of the Text InputFields in UITK. We have a update in landing patterns now that will fix SOME issues with the inputfield at runtime this will go to 2021.2. This however will by no means will fix all the known issues.

    As Xenerade said we are working on moving the TextFields over to our new Text system instead of it relying on the old. This work will happen in steps but until its complete i'm unable to make a call on the complexity/ risk of backporting it to 21.2. If its a simple enough change I will do what i can to have this backported.

    If I can't get it backported we can look into what are the major blocking issues and try our best to address those.
     
    Midiphony-panda likes this.
  13. perholmes

    perholmes

    Joined:
    Dec 29, 2017
    Posts:
    296
    It sounds like there are more issues than I'm aware off. In immediately use, only the lack of selection display stuck out. If only that fix were back-ported, I feel like the text field could be used as-is in 2021.2, with a Known Issues thing written into the manual page.

    But since I now moved to 2022.1 and am fully functional, I'm concerned whether will 2022.1 see updates to UI Elements, or will 2021.2 alone still receive the bulk of the updates?
     
  14. antoine-unity

    antoine-unity

    Unity Technologies

    Joined:
    Sep 10, 2015
    Posts:
    780
    No worries, 2022.1 will always contain anything that gets backported to earlier versions.
     
  15. Nexer8

    Nexer8

    Joined:
    Dec 10, 2017
    Posts:
    271
    Text selection now works in 2021.2.0b14.
     
  16. perholmes

    perholmes

    Joined:
    Dec 29, 2017
    Posts:
    296
    I went ahead and jumped on 2022.1.0a7, but glad to see things are being back-ported. Cursor still doesn't blink, and there's no mobile keyboard selection, so it's only barely working on mobile. Unity says they're going for desktop/editor parity before putting more energy into runtime UI, which I think is a pity, since I personally couldn't care one bit about UIElements in the editor.
     
    Nexer8 likes this.
  17. Nexer8

    Nexer8

    Joined:
    Dec 10, 2017
    Posts:
    271
    UI Toolkit for the editor has proven quite useful, but other than that I agree. Proper mobile support should be a priority.
     
    MousePods likes this.
  18. perholmes

    perholmes

    Joined:
    Dec 29, 2017
    Posts:
    296
    Since the runtime UI will have hundreds of millions of users, but the editor UI will have only hundreds of thousands, I think the runtime UI should get most of the love. You can tolerate quirks in the editor UI, but those same quirks are deal-breakers for releasing any runtime UI to the public. So I think it should be Runtime #1, Editor #2.