TextInput - #24929
Conversation
* FeathersLazyMenu * FeathersMenuToolButton
There was a problem hiding this comment.
Seems fine, agree with the overall direction. I think maybe instead of the bool param on queue_edit, we could implement an is_destructive method for TextEdit that returns true for destructive TextEdit s.
Also I haven't thought it through properly but possibly there could be problems with IME if the widget is changed to readonly during composition? I'm not sure we should worry too much though.
| return; | ||
| }; | ||
|
|
||
| if *text_input == TextInput::DisplayOnly { |
There was a problem hiding this comment.
| if *text_input == TextInput::DisplayOnly { | |
| if *text_input != TextInput::Editable { |
| @@ -360,7 +413,7 @@ fn update_ime_position( | |||
| /// IME is enabled when an `EditableText` gains focus and disabled when focus moves elsewhere. | |||
There was a problem hiding this comment.
Needs to be updated to add that IME state also depends on TextInput now.
| mut editable_text_query: Query<&mut EditableText, With<TextInput>>, | ||
| ) { | ||
| if let Ok(mut editable_text) = editable_text_query.get_mut(trigger.entity) { | ||
| editable_text.queue_edit(TextEdit::clear_ime_compose()); |
There was a problem hiding this comment.
We also need to queue TextEdit::clear_ime_compose() somewhere when TextInput changes away from Editable.
Edit: Added it to the suggested changes for listen_for_ime_input_when_text_input_focused.
| /// Cursor movement, selection, and copy to clipboard is still enabled, but no mutations are allowed | ||
| ReadOnly, | ||
| /// Display only, all interactions disabled - this is used by number input widget when dragging. | ||
| DisplayOnly, |
There was a problem hiding this comment.
Then this could be NonInteractable or something.
There was a problem hiding this comment.
I also thought about Static
Co-authored-by: ickshonpe <david.curthoys@googlemail.com>
|
@ickshonpe @alice-i-cecile So we have a couple of outstanding issues here. First, there's a system ambiguity which is causing the CI to fail, and which I am unsure how to fix. Second, there's some unfinished bikeshedding around the naming and role of the As I see it, we have two choices about how we can structure this: Choice 1: The biggest problem here is what to do about accessibility: we need to add Choice 2: Finally, I want to mention that I need to solve this problem to unblock my work on |
|
Responded in #24929 (comment) :) Let me know if you can't work out the resolution of the ambiguity and I'll take a look. |
…25104) # Objective - Part of bevyengine#24112 ## Solution - Very straightforward port - The only thing that is slightly new is adding `Hovered` to the `FeathersRadio` helper entity to support some of this example’s functionality re: blocking drag when over a radio button. ## Testing - `cargo run --example mirror --features=“bevy_feathers”` should work the same. Strangely this functions _better_ than main for me when moving the fox. --- ## Showcase <img width="1286" height="753" alt="Screenshot 2026-07-21 at 2 23 54 PM" src="https://github.com/user-attachments/assets/dbca9793-a966-4c9f-91fa-b57e471da998" />
…WriteMode::Readonly`. This will be revisited after we refactor/rethink `InteractionDisabled`.
|
Looks like my latest change broke CI, not sure what caused it. Oh, wait, I think I know. |
I very strongly favor choice 2. I wanted it to change it to this earlier, but it felt irresponsible to demand a big refactor with the 0.19 release coming up. |
|
Well, the tests are failing, and I'm very confused: the test that is being reported as failing ( |
|
Freshly added; I just merged in main for you. |
kfc35
left a comment
There was a problem hiding this comment.
I think the transitions between drag states for the number input needs more tweaking.
While testing in feathers gallery:
When I click in to edit a number input value and then click out of it, I expected to be able to scrub the same number input, but instead it seems to insist that I still want to edit it numerically. I would expect that when I click away (lose focus) that I should be able to scrub again. Only after I press enter am I able to pointer scrub again, but the cursor doesn’t make it obvious (it has the typing cursor, not the scrubber one). It only turns back into the scrubber one after I click outside of the number input.
Overall, I think the separation of EditableText and TextInput makes sense to me. I couldn’t find any problems with read-only mode and static. The read-only mode is nice and can come in handy.
I can re-review later if you intend to fix the above problem with number input value, but I also don’t mind approving now and for that to be addressed in a (hopefully quick) follow up
| if !input_focus.is_changed() { | ||
| return; | ||
| } | ||
| // React to removal of `TextReadWriteMode`, and drain the whole reader (using `.count()`) so that |
There was a problem hiding this comment.
This comment doesn’t make sense to me within the context of this function
Good catch, that was a real bug; I thought I had caught that case but I missed that one (so...many...observers!). I've pushed a fix. |
kfc35
left a comment
There was a problem hiding this comment.
I have a few suggested comments/solutions related to the what the cursor should look like under certain circumstances for the number input. Beyond that, functionally everything seems to work as expected.
There was a problem hiding this comment.
I found that after scrubbing a number input once and then hovering back over the number input, the cursor would become the i-beam instead of staying as ColResize because technically it has focus here. I don’t think that makes sense — it should stay as ColResize unless the user has entered edit mode.
If you add a check here to ensure that the EditMode is Editing here, that solves this particular problem.
There was a problem hiding this comment.
These are good suggestions - I'll try to work on them today at the club meeting.
Note that I'm not super happy with the ColResize cursor - I would prefer something lighter weight that didn't block the view so much. But unfortunately winit doesn't support the full set of standard CSS cursors: many of the standard winit cursors map to the same icon. Otherwise, I would use the standard EWResize icon, which is a bit smaller.
There was a problem hiding this comment.
This specific line looks like a hold-over from the previous logic, I'm going to delete it.
|
FYI there is a big missing piece in terms of accessibility that you may want to consider early on: the content of a text input should not be set as value on the AccessKit node with |
|
This was a challenging merge (text input + new theming system). |
What you are describing seems like the kind of thing that would be appropriate for a rich text editor, not a simple string editor like this. |
All platform accessibility APIs allow assistive technologies to navigate inside text content using some form of range API. If Bevy's text inputs don't expose their content as text runs, they will appear as read-only and without caret to assistive technologies. |
That seems like it would be difficult to implement, as we have no concept of a "text run" in this context. While bevy does have text runs for static text blocks, for text input it's just a plain string - things like rich text or syntax highlighting have been declared out of scope, and would likely be supported by third-party crates, not the core engine. I'm curious as to what the recommendation would be for something like a username or password login field? |
|
While its API is not ideal, parley has an AccessKit integration gated behind the "accesskit" Cargo feature which can easily support small text inputs. I'm guessing that the biggest open question would be how to pick node IDs for the text runs. |
This PR splits the functionality of the
EditableTextcomponent into two separate components:EditableText(which lives in bevy_text) andTextInput(which lives in bevy_ui_widgets).See release notes for more details.