From b509eff886e1b90fc7e2180dc50e2568407eebe1 Mon Sep 17 00:00:00 2001 From: dualfroz Date: Sat, 17 Oct 2026 03:26:00 +0200 Subject: [PATCH] [text field] Fix outline gap without a label in Firefox Firefox applies the inherited letter-spacing to the zero-width space in the unlabeled legend, which leaves a 0.15px gap in the border. Cap the legend at `maxWidth: 0` when there is no label. --- packages/mui-material/src/OutlinedInput/NotchedOutline.js | 1 + .../mui-material/src/OutlinedInput/NotchedOutline.test.js | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/packages/mui-material/src/OutlinedInput/NotchedOutline.js b/packages/mui-material/src/OutlinedInput/NotchedOutline.js index e4b314e..7691b59 100644 --- a/packages/mui-material/src/OutlinedInput/NotchedOutline.js +++ b/packages/mui-material/src/OutlinedInput/NotchedOutline.js @@ -39,6 +39,7 @@ const NotchedOutlineLegend = styled('legend', { style: { padding: 0, lineHeight: '11px', // sync with `height` in `legend` styles + maxWidth: 0, ...getTransitionStyles(theme, 'width', { duration: 150, easing: theme.transitions.easing.easeOut, diff --git a/packages/mui-material/src/OutlinedInput/NotchedOutline.test.js b/packages/mui-material/src/OutlinedInput/NotchedOutline.test.js index 456229c..c39f1d2 100644 --- a/packages/mui-material/src/OutlinedInput/NotchedOutline.test.js +++ b/packages/mui-material/src/OutlinedInput/NotchedOutline.test.js @@ -64,4 +64,11 @@ describe('', () => { }); }, ); + + it.skipIf(isJsdom())('should not leave a gap in the outline without a label', () => { + const { container } = render( + , + ); + expect(container.querySelector('legend').getBoundingClientRect().width).to.equal(0); + }); });