Repository navigation
feat(input): name the input's root element after the caller's id - #143
Merged
Merged
Conversation
MoonInput and MoonNumberInput take an id but used it only as the key
of their keyed state; the element they drew was keyed by the state
entity (`("input", entity_id)`), a number that differs between
launches. Anything that addresses controls by element path — the
inspector, a scripted test, a docs capture — saw every field of a form
as MoonUI's inner `input-state`, with nothing to tell them apart.
- `Input::id` and `NumberInput::id` name the root element; without one
the root keeps its entity key, so direct users are unaffected.
- `MoonInput` and `MoonNumberInput` pass their own id there.
- Mirror baseline refreshed for the two touched donor components.
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.
What & why
MoonInput::new(id)andMoonNumberInput::new(id)take an id, but it only keyed their state: the element they render was keyed by the state entity (("input", entity_id)/("number-input", entity_id)), a number that changes between launches. By element path every field of a form was MoonUI's innerinput-state, so anything that addresses controls by path — the GPUI inspector, a scripted test, MoonTerminal's UI-atlas capture — could not tell one field from another (84 of them in the terminal's atlas collapsed this way).Changes
Input::id(impl Into<ElementId>)andNumberInput::id(..)name the root element. Without a call the root keeps its entity key, so direct users ofInput/NumberInputsee no change.MoonInputandMoonNumberInputpass their own id to it.docs/component-mirror-baseline.jsonrefreshed for the two touched donor files (input/input.rs,input/number_input.rs). The component API baseline did not change.Notable decisions
div: a wrapper would sit between the caller's flex layout and the input and change its sizing (and breakMoonInput::bounds' absolute placement).MoonInput::newid is unique; the one repeat is in a test file.How to verify
Checked against MoonTerminal through a local
[patch]: build,clippy --workspace --all-targets -D warningsandcargo test --workspacegreen; a full UI-scene capture of 152 screens differs from the previous one by at most 0.12 % of pixels per screen, and every field now carries the caller's id.