flet-dev / flet-dev/flet

Bug: shift_enter does not work as expected

Open
#1,106 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
17k
Forks
694
Avg merge
1d 14h
Merged PRs (30d)
33

Description

making a textfield shift_enter true works as expected, however leaving it alone or making it false makes both enter and shift_enter work the same, they just go to a new line

def main(page: ft.Page):
    page.add(
        ft.TextField(
            label="Auto adjusted height with max lines",
            multiline=True,
            min_lines=1,
            max_lines=3,
            # shift_enter=True,
            on_submit= lambda e: print("Submitted"),
        ),
    )


ft.app(target=main)

with the shift_enter line uncommented I get an on_submit as expected, with it commented, I do not get an on_submit

Name: flet
Version: 0.4.2
Summary: Flet for Python - easily build interactive multi-platform apps in Python
Home-page: 
Author: Appveyor Systems Inc.
Author-email: hello@flet.dev
License: Apache-2.0
Location: /Users/gregor.brandt/Documents/Startbridge/web-app2/fe_env/lib/python3.11/site-packages
Requires: flet-core, httpx, oauthlib, packaging, watchdog, websocket-client, websockets
Required-by: 

Operating system:

Additional environment details:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run the provided Python TextField example with Flet 0.4.2, comparing shift_enter=True with the default or false setting. Trace the TextField submit and newline behavior from this reproduction; done means Enter and Shift+Enter follow the documented distinct behavior and on_submit is triggered as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.