Skip to content

Fix the plaintext floating label border width - #43446

Draft
julien-deramond wants to merge 35 commits into
mainfrom
v6-jd-floating-plaintext-label-border
Draft

julien-deramond wants to merge 35 commits into
mainfrom
v6-jd-floating-plaintext-label-border

Conversation

@julien-deramond

@julien-deramond julien-deramond commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Warning

This PR is built on top of #43441 (forced colors) and must be merged after it. Until #43441 is merged, the diff here also shows its commits: this PR's change is only the last commit, 44d2c2c.

The floating label for a .form-control-plaintext sets border-width: var(--control-border-width) 0, but --control-border-width is defined on the control, not on the label, which is its sibling. The declaration is invalid at computed-value time, so the label falls back to medium (3px) on every side, and its text sits about 2px to the right of the plaintext value. This uses --border-width instead, as the base floating label rule already does, so the label gets 1px top and bottom and no inline border, which is what the rule intends.

Before After
before: plaintext floating labels after: plaintext floating labels

The red line marks the start of the input's text. Before, the plaintext labels start to its right; after, they line up with the value, like the regular input below them.

The regression came with the move from Sass variables to tokens (#41983), which replaced $input-border-width with the custom property.

Checks

Compiled CSS (dist/css/bootstrap.css):

   .form-floating > label:has(~ .form-control-plaintext) {
-    border-width: var(--bs-control-border-width) 0;
+    border-width: var(--bs-border-width) 0;
   }

Measured in Chromium on the "Readonly plaintext" docs examples, with a regular floating input as reference (label text start minus input text start):

Case Label border (block / inline), before After Offset before After
Plaintext, empty 3px / 3px 1px / 0 2.34px -0.21px
Plaintext, with value 3px / 3px 1px / 0 2.34px -0.21px
Regular input (unchanged) 1px / 1px 1px / 1px -0.36px -0.36px

The small negative offsets come from the floated label's scale(). The vertical position of the label doesn't change.

Checks: npm run css-lint passes, and the compiled CSS diff is the one line above. In forced colors mode, #43441 replaces this label's border with padding of the same width, so the label text there also lines up with the value (-0.21px, the same as in normal mode). In right to left, the plaintext label borders are also 1px / 0 after the fix. The floated label offsets there are larger for every input, the regular one too, because of the label's transform; that is unrelated to this change and wasn't investigated here.

Not checked: Firefox and Safari (the change only makes an invalid declaration valid).

<div class="form-floating">
  <label for="a">Empty input</label>
  <input type="email" readonly class="form-control-plaintext" id="a" placeholder="name@example.com">
</div>
<div class="form-floating">
  <label for="b">Input with value</label>
  <input type="email" readonly class="form-control-plaintext" id="b" placeholder="name@example.com" value="name@example.com">
</div>

In DevTools, the label's computed border-top-width and border-inline-start-width are 3px on main and 1px / 0 with the fix.

coliff and others added 30 commits November 22, 2026 10:26
…lors() mixin

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lors() mixin

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n skill

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
julien-deramond and others added 5 commits November 23, 2026 08:26
A transparent outline outside the media query replaced the browser focus ring on a focusable avatar, and ignored $enable-forced-colors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@julien-deramond
julien-deramond requested a review from a team as a code owner November 23, 2026 07:47
@netlify

netlify Bot commented Nov 23, 2026

Copy link
Copy Markdown

✅ Deploy Preview for twbs-bootstrap ready!

Name Link
🔨 Latest commit 44d2c2c
🔍 Latest deploy log https://app.netlify.com/projects/twbs-bootstrap/deploys/6b03ef7825f0507b6b4f6ffa
😎 Deploy Preview https://deploy-preview-43446--twbs-bootstrap.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@julien-deramond
julien-deramond marked this pull request as draft November 23, 2026 07:49
@julien-deramond julien-deramond added v6 v6, the main branch bug Something does not work as documented css Sass sources or compiled CSS labels Nov 23, 2026
@julien-deramond julien-deramond added the has-conflicts Conflicts with its base branch: needs a rebase label Nov 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something does not work as documented css Sass sources or compiled CSS has-conflicts Conflicts with its base branch: needs a rebase v6 v6, the main branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants