Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enter does not change line inside textarea component #1035

Open
athioak7 opened this issue May 14, 2024 · 1 comment
Open

Enter does not change line inside textarea component #1035

athioak7 opened this issue May 14, 2024 · 1 comment

Comments

@athioak7
Copy link

Please fill out the below information as much as possible.

  • dash version: #2.16.1
  • dash-bootstrap-components version: #1.5.0
  • components affected by bug: textarea

What is happening?

I recently updated my libraries and went from DBC 1.2.0 to 1.5.0. I noticed that I could no longer use 'Enter' inside the textarea to change line, instead I had to use Shift+Enter. When I reverted back to the previous version the issue was fixed. This is also how the textarea responds in the BDC Documentation page.

What should be happening?

On 'Enter' the line should change, as this is the default behavior for a plain textarea.

@tcbegley
Copy link
Collaborator

Thanks for submitting this @athioak7

With hindsight, I agree that this doesn't seem quite right, I think the current behaviour was inspired by chat based apps where enter normally sends the message and shift enter allows you to add a new line. Unfortunately a quick search on GitHub suggests there are a number of people out there making use of this behaviour.

Therefore I propose the following, adding a new prop submit_on_enter which one can simply set to False to ensure that pressing Enter creates a new line.

I have implemented this and created a pre-release, feedback is welcome

pip install dash-bootstrap-components==1.6.1rc2

Here's a simple app you can try with.

import dash_bootstrap_components as dbc
from dash import Dash

app = Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])

app.layout = dbc.Container(
    dbc.Textarea(id="textarea", submit_on_enter=False), className="p-5"
)

if __name__ == "__main__":
    app.run_server(debug=True)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants