On inputText click the pointer should not go through it

Hey,
How can I stop picking go through InputText element?
isPointerBlocker doesn’t seem to work :thinking:

https://playground.babylonjs.com/#UWS0TS#228

No, the pointerBlocker will not work for inputText. In a way, I believe it’s understable and consistent: Why have an inputText if you cannot input text, yes?
There are a number of work-arounds you can use. The most obvious is to remove the observable (freeze the control) when entering the area (generally a placeholder/container for the inputText).
A bit of the same you would do with other controls such as i.e. the scrollviewer, depending on context.
Actually, good question: what is the context? Where the inputText is visible but cannot be used?

Edit: You don’t have to answer (unless you want :wink: I believe ‘isReadOnly’ depending on context is probably the best option

Hi,
I can answer with other question, Why to use InputText without inputText functionality? then simple use TextBlock instead :wink: …buut this is not the case. It is actualy a menu linked to a customizable mesh, so based on user input value we update the mesh, so the user definetly have to click the input.

I think I’m missing something :frowning:

I understand. Makes sense. However, the PG above should work for your use case.
Click on the button to unlock the InputText.
Simply use ‘isReadOnly’ (true or false) depending on whether you want the input editable or locked.
Anything I missed here?

Basically the main issue, on input click the pointer should not go through it

The pointerUp? I thought you just wanted to block the text input.

Edit: We must have a different understanding of this. Can you explain with other words what you mean when you say “On inputText click the pointer should not go through it”. I’m afraid I’m not understanding this correctly.

Oh, sory. I’ll try in other way then.
If you open the console you’ll see the name of clicked mesh. Now if you click the gui button ‘click me’ the name of mesh is not showed (I would say expectd because is a gui element). but if you click on input, the name of mesh is showed (unexpected)

I checked again and with 4.2.1 version it is working well. So it is a bug :open_mouth: and has nothing to do with isPointerBlocker

Thanks for the new info.
I indeed misunderstood your question. It’s much clearer now
I am not sure it’s a bug. Changes have been made to this control.
I suppose I found a solution or go-around, if I (finally :wink: understand correctly what you want.
In this PG, using onBlurObservable you can edit the input without picking the sphere until you confirm the input (pressing ‘enter’).

Let me just call-in @carolhmj to understand if this is a new and expected behavior or a bug?

1 Like

I’ll investigate and discuss with @RaananW :thinking:

1 Like

I tested with some more different controls and Rectangle, Image and Checkbox all have the same behavior as Button, so it does seem there is something going on with InputText: pannel button and input | Babylon.js Playground (babylonjs.com)

3 Likes

Finally found out the cause :smiley: PR is here isPointerBlocker fixes by carolhmj · Pull Request #12787 · BabylonJS/Babylon.js (github.com)

3 Likes