Repository navigation
Conversation
With debounce (the default for mo.ui.text and mo.ui.text_area) the character counter read the committed value, so it stayed at 0/N while typing and only caught up on blur or Ctrl+Enter. The counter now renders from the input's current value.
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
burrows99
marked this pull request as ready for review
November 24, 2026 00:39
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request was authored by a coding agent.
📝 Summary
With
max_length,mo.ui.textandmo.ui.text_areashow a character counter. Both default todebounce=True, and in that mode the counter read the committed value, so it stayed at0/20while you typed and only caught up when you left the field or pressed Ctrl+Enter. The same happened with a numericdebounce.The live value is held inside
OnBlurredInput/DebouncedInput(and the textarea versions), so the plugin can't see it.Input'sendAdornmentandTextarea'sbottomAdornmentnow also accept a function of the current value, and the two plugins pass the counter as one. The other adornment caller (the keyboard shortcut editor) passes a node and is unchanged. When the value reaches Python is unchanged.flowchart TD A[Type Hello marimo into a text field with max_length 20] --> B{Counter while typing} B -->|Before| C[Stays at 0 of 20 until blur] B -->|After| D[Shows 12 of 20]Narrated recording, before then after (sound on):
text-counter.mp4
Edge cases and unchanged behavior checked
Checked in the running editor (Vite dev server and
marimo editfrommainat a8d229e, then this branch, same notebook withmo.ui.text(max_length=20),mo.ui.text_area(max_length=80)andmo.ui.text()), and shown in the recording:Hello marimoleaves the title counter at0/20; it shows12/20only after moving to the summary, whose counter then stays at0/80while typing.12/20and the summary counter15/80while typing.20/20(the nativemaxlengthstill refuses extra characters).14/20).mo.ui.text()withoutmax_lengthshows no counter.Covered by tests only:
debounce=200for both widgets.Tests
vitest run src/plugins/impl/__test__/text-labels.test.tsx: new test "counts typed characters before committing" fortextandtext_areawithdebounce=trueanddebounce=200. The 4 cases fail onmain(counter stays0/10) and pass on this branch.vitest run src/plugins/impl/ src/components/ui/ src/components/editor/controls: 69 files, 934 passed.tsgo(frontend typecheck): clean.oxlintandoxfmt --checkon the changed files: clean.make check, the Python suite, e2e.AI assistance (Claude Code) was used for this change; the bug was reproduced and the fix checked in the running editor by the agent.
📋 Pre-Review Checklist
✅ Merge Checklist
🤖 Generated with Claude Code