Skip to content

number_input not accepting keyboard input correctly #12349

@RhysyT

Description

@RhysyT

Checklist

  • I have searched the existing issues for similar issues.
  • I added a very descriptive title to this issue.
  • I have provided sufficient information below to help reproduce this issue.

Summary

In version 1.49.0, using the keyboard to enter a value in an st.number_input box only alters the first number (e.g. typing 123 just gives 1.0). The backspace button also does not work. This does not happen in 1.48.1. The +/- incremental buttons function correctly. Does not depend on whether format or key is specified or not.

Reproducible Code Example

Open in Streamlit Cloud

import streamlit as st
st.number_input("Anything")

Steps To Reproduce

Run the above code in 1.49.0. Try and type a value in the input box using the keyboard. Try again in 1.48.1 and compare the behaviour.

Expected Behavior

I should be able to type any numeric value in full in the input box and be able to delete using the backspace key, also to select the input by left-click-drag.

Current Behavior

Entering a value using the keyboard is impossible as only the first number typed is accepted : instantly the input stops. Using the backspace key does nothing. This makes it impossible to type in a specific value as only the increment +/- buttons are properly functional. No error messages are reported.

Is this a regression?

  • Yes, this used to work in a previous version.

Debug info

  • Streamlit version: 1.49.0
  • Python version: N/A
  • Operating System: N/A
  • Browser: Reproduced buggy and functional behaviour on Chrome (Windows and Android).

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature:st.number_inputRelated to the `st.number_input` widgetpriority:P1High priority - fix within two weeksstatus:confirmedBug has been confirmed by the Streamlit teamtype:bugSomething isn't working as expectedtype:regressionThis bug is a regression from previous behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions