Repository navigation
fix(harmonyos): style text fields through TextInput's own attributes - #884
Merged
Merged
Conversation
houko
force-pushed
the
fix/harmony-text-rendering-811
branch
from
November 19, 2026 16:34
f48bf5e to
55452fd
Compare
Collaborator
Author
|
Not merging yet: checked on the HarmonyOS 6.0.2 phone emulator (3.5 pixels a point), the PR fixes only the first of #811's three points. Pushed on top: an unset What the emulator shows:
So the acceptance ("match Android for the three points") is not met for points 2 and 3. These need iteration on the emulator, and comparison with Android, before merging. |
houko
force-pushed
the
fix/harmony-text-rendering-811
branch
from
November 19, 2026 22:45
55452fd to
9c6e180
Compare
An unset PlaceholderColor is 0, which the host was sent as transparent and drew no placeholder at all; send none, as the other targets keep the platform's, and test that the drawn text leaves out attachment runes.
The composer's and the Combobox's grey capsule, larger placeholder and unpadded text had one cause: ArkUI's TextInput keeps its theme's background, corners, border and padding unless its own attributes set them, and the common attributes style() writes never reach them. The host now writes the engine's background, corners and border through the TextInput's attributes too, transparent where the engine gives none, and pads the field to the content box the engine laid out (InputConfig.Content, now sent with the "in" op), as Android and the web place their editors. A single line is centered by ArkUI in that box, so only a multi-line field keeps an explicit lineHeight. The text engine also measures the text it draws, without attachment runes, so a measured line is the line ArkUI draws. Inline views themselves are still not drawn on HarmonyOS: the engine has no attachment layout there yet, which the roadmap now records under #811, and the architecture document no longer says their views are mounted. Checked on the HarmonyOS 6.0.2 phone emulator with a host compiled from these templates: the Select page's Combobox matches the Select's field, and the Conversation composer shows its placeholder at 13.5 pt in its faint color, inset by its padding, with no capsule.
houko
force-pushed
the
fix/harmony-text-rendering-811
branch
from
November 19, 2026 23:29
9c6e180 to
947176a
Compare
Collaborator
Author
|
Reviewed. |
This was referenced Nov 19, 2026
Closed
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.





Part of #811
Summary
TextInputkeeps its theme's grey capsule, padding and default font unless its own attributes set them, and the common attributes the renderer writes for every view (style()) never reach its background, corners or border. The host now writes the engine's background, corners and border through theTextInput's attributes too, transparent where the engine gives none, pads the field to the content box the engine laid out (InputConfig.Content, now sent with theinop, as Android and the web place their editors there), and gives the placeholder the field's font and, when the app sets one, its color (an unsetPlaceholderColorkeeps the platform's, as Android does). ArkUI centers a single line in that box, so only a multi-line field keeps an explicitlineHeight.core.AttachmentLayout), so the engine hides them. That needs the text laid out with placeholders on the host and reported back synchronously, which is its own piece of work, so the roadmap records it under HarmonyOS preview: text rendering differences in the gallery #811 and the issue stays open.Why the first review saw no change for the text fields
nsgo test -target harmonyoswithouthvigorwandOHOS_BASE_SDK_HOMEpackages the committed host incmd/nsgo/harmony/host/, not the templates, and that host predates the last seven template commits, so theIndex.etschanges never ran. Filed as #907. The screenshots below were taken with a host compiled from this branch's templates on the Mac Studio's DevEco SDK (test-only build, not committed); the committed host is left as it is, for #907.Screenshots
HarmonyOS 6.0.2 phone emulator, gallery pages; before is
main, after is this branch.Text page, inline views:
Select page, Combobox:
Conversation page, composer:
Verification
go tool nsgo test ./cmd/nsgo/harmony(ops and host checks),go tool nsgo test -target web ./internal/platform/harmonyos(TestTextDrawsNoAttachmentRunes),go tool nsgo check -target harmonyos.Index.etscompiled with hvigor; the emulator run above used that host.