Open miguelcmedeiros opened 1 year ago
Cc @matthew-carroll @angelosilvestre
@miguelcmedeiros I think the problem here is that when you say TextInputConfiguration(keyboardAppearance: Brightness.light)
you're automatically choosing a text input action of "done". Therefore, when you press ENTER, it doesn't trigger a newline selector, it triggers a done behavior, which moves the focus.
Can you try passing an input action of "newline" and see if that solves the problem?
From what I tested it now seems that setting imeConfiguration
in SuperTextField
should only be done for mobile. When used on desktop, it results in this kind of issue.
@miguelcmedeiros I don't think passing the IME configuration is optional. That's where we enable deltas, control autocorrection, etc.
The only question is whether SuperTextField
creates that config, making all such decisions on your behalf, or whether the app developer is allowed to make those decisions (except for deltas).
You said "results in this kind of issue" - are you seeing multiple issues, or just this one? Did setting the action to newline
fix the issue in your original post?
Text fields, even on desktop, might be single line, and therefore shouldn't insert a new line under any circumstances. It might be the case that moving focus isn't the desired action, but I think that policy is set with other Flutter code, like an app's Actions
widget or something like that. I believe the decision is made outside the text field, so I wouldn't say it's really the fault of the done
action setting.
Thoughts?
Also, @angelosilvestre feel free to chime in on this if you have thoughts, too.
TextInputConfiguration
by default sets the inputType
to TextInputType.text
. It's possible that this prevents the textfield from inserting multiple lines.
@miguelcmedeiros Could you please try to pass TextInputType.multiline
as the inputType
?
@miguelcmedeiros can you take another look at this thread and update us on the questions above?
@angelosilvestre apologies for the delayed reply.
I tried setting inputType
as TextInputType.multiline
and even then pressing SHIFT+ENTER will not add a new line, and instead, the text field loses focus.
@miguelcmedeiros @matthew-carroll I tested this and the issue is happening because the TextInputConfiguration
inputAction
defaults to TextInputAction.done
, which causes the textfield to lose focus.
When an imeConfiguration
isn't provided to SuperTextField
, it sets the inputAction
to TextInputAction.newline
if the textfield is multiline.
To fix this issue you need to provide the inputAction
to the imeConfiguration
, like the following code:
imeConfiguration: TextInputConfiguration(
keyboardAppearance: Brightness.light,
inputType: TextInputType.multiline,
inputAction: TextInputAction.newline,
)
With this configuration it's possible to insert new lines.
@angelosilvestre I think that's what we had already discovered above. @miguelcmedeiros can you please take another look through this thread and give us some broader description of the problem? When you verified the problem recently, did you try altering the input action as mentioned earlier in the thread?
If this ticket still truly represents a problem then I think we need a clearer set of pre-conditions for the expected output behaviors.
Steps to reproduce:
TextInputConfiguration
toDesktopSuperTextField.imeConfiguration
, likeExpected: new line is added Actual: text field loses focus
The issue is reproducible on the macOS app and macOS web.