Title: CSS transform: percentage translate values silently parsed as dips (translate(-50%) → -50dip) · Issue #11457 · NativeScript/NativeScript · GitHub
Open Graph Title: CSS transform: percentage translate values silently parsed as dips (translate(-50%) → -50dip) · Issue #11457 · NativeScript/NativeScript
X Title: CSS transform: percentage translate values silently parsed as dips (translate(-50%) → -50dip) · Issue #11457 · NativeScript/NativeScript
Description: Issue Description Runtime styling divergence — no error and no warning. Percentage arguments to translate()/translateX()/translateY()/translate3d() inside a transform declaration are parsed with parseFloat, which silently drops the % and...
Open Graph Description: Issue Description Runtime styling divergence — no error and no warning. Percentage arguments to translate()/translateX()/translateY()/translate3d() inside a transform declaration are parsed with pa...
X Description: Issue Description Runtime styling divergence — no error and no warning. Percentage arguments to translate()/translateX()/translateY()/translate3d() inside a transform declaration are parsed with pa...
Opengraph URL: https://github.com/NativeScript/NativeScript/issues/11457
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"CSS transform: percentage translate values silently parsed as dips (translate(-50%) → -50dip)","articleBody":"## Issue Description\n\nRuntime styling divergence — no error and no warning. Percentage arguments to `translate()`/`translateX()`/`translateY()`/`translate3d()` inside a `transform` declaration are parsed with `parseFloat`, which silently drops the `%` and applies the number as dips.\n\n`transform: translate(-50%, -50%)` — the standard self-centering idiom — moves a view by −50dip instead of −50% of its own size.\n\nPer CSS Transforms, translate arguments are `\u003clength> | \u003cpercentage>`, where percentages resolve against the element's own reference box (width for x, height for y).\n\nRoot cause: `convertTransformValue` in `packages/core/ui/styling/css-transform.ts` does `rawValue.split(',').map(parseFloat)`, so `parseFloat('-50%')` → `-50`. This path is reached by both the `transform:` shorthand (`convertToTransform` in `style-properties.ts`) and `transform` declarations inside `@keyframes` (`css-animation-parser.ts`). The `translateX`/`translateY` longhand properties behave the same way via `FixedLength.parse`.\n\nRelated: #3707 tracks percentage support as a feature request (open since 2017). Filing separately because the silent mis-parse is a correctness bug independent of whether % support lands — today the engine produces a plausible-looking but wrong dip offset with no signal. If full percentage support is out of scope, rejecting or warning on unsupported units would at least make shared stylesheets fail loudly.\n\nHappy to PR either direction (percent-of-self support, or loud rejection of unsupported units) if maintainers indicate a preference.\n\n## Reproduction\n\n```xml\n\u003cStackLayout width=\"200\" height=\"200\" class=\"box\"/>\n```\n\n```css\n.box {\n\ttransform: translate(-50%, -50%);\n}\n```\n\n1. `ns run ios` or `ns run android`\n2. The view is offset by −50dip on each axis\n3. Expected: offset by −100dip on each axis (50% of its own 200dip size)\n\nSame through keyframes — the common slide-in-from-offscreen animation:\n\n```css\n@keyframes slide-in {\n\tfrom {\n\t\ttransform: translateY(100%);\n\t}\n\tto {\n\t\ttransform: translateY(0);\n\t}\n}\n```\n\n`translateY(100%)` starts the view 100dip lower instead of one full view-height lower, so tall views remain partially on screen.\n\n## Relevant log output (if applicable)\n\nNo output — the value is silently mis-parsed.\n\n## Environment\n\n- `@nativescript/core` 9.1.2; also verified against current `master` (`convertTransformValue` is unchanged)\n- Platforms: iOS and Android (platform-agnostic CSS parser)\n","author":{"url":"https://github.com/aleclarson","@type":"Person","name":"aleclarson"},"datePublished":"2026-09-27T02:05:41Z","url":"https://github.com/NativeScript/NativeScript/issues/11457"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0f5564e4-76cd-c848-64c4-172c68a0b943 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8D1C:2D96F1:161DE00:1D38474:6B01301A |
| html-safe-nonce | 2cdb54c1ee887e63cd6a7bca6f156fd8a5beb6d300b30b6fdc097df28d3d4d02 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RDFDOjJEOTZGMToxNjFERTAwOjFEMzg0NzQ6NkIwMTMwMUEiLCJ2aXNpdG9yX2lkIjoiNjA5ODY5MTcyMzQ1MjU1OTM4NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 0d2e205ea09d0301ede0563b0b71b77ac0c39c1d07390de8c798fd381d95d576 |
| hovercard-subject-tag | issue:5599039914 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NativeScript/NativeScript/11457/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e45bf7217a58d5e525e36b3b8e687052e3870b39a73c35a904aac31cfcc48084/NativeScript/NativeScript/issues/11457 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e45bf7217a58d5e525e36b3b8e687052e3870b39a73c35a904aac31cfcc48084/NativeScript/NativeScript/issues/11457 |
| og:image:alt | Issue Description Runtime styling divergence — no error and no warning. Percentage arguments to translate()/translateX()/translateY()/translate3d() inside a transform declaration are parsed with pa... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | aleclarson |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/NativeScript/NativeScript git https://github.com/NativeScript/NativeScript.git |
| octolytics-dimension-user_id | 7392261 |
| octolytics-dimension-user_login | NativeScript |
| octolytics-dimension-repository_id | 31492490 |
| octolytics-dimension-repository_nwo | NativeScript/NativeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31492490 |
| octolytics-dimension-repository_network_root_nwo | NativeScript/NativeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width