Skip to content

[babel-plugin][legacy] Polyfill float values for legacy browser support #1217

@mellyeliu

Description

@mellyeliu

We can polyfill inline-start and inline-end float values using CSS custom properties alongside [dir="ltr"] selectors. This is a for long-term migration off of LTR/RTL polyfill completely

Note: --start and --end are for descriptive purposes. We should generate a hashed name here instead

Details:

So we get:

.f-s {
  /* float: inline-start; */ 
  float: var(--start);
}
.f-e {
  /* float: inline-end; */
  float: var(--end);
}

We then need to add something like this within the broader sheet in processStylexRules if the rules metadata contains a float property (https://github.com/facebook/stylex/blob/main/packages/%40stylexjs/babel-plugin/src/index.js#L359):

:root, [dir="ltr"] {
  --start: left;
  --end: right;
}
[dir="rtl"] {
  --start: right;
  --end: left;
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions