You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
macOS: a borderless TextField with a background color overhangs its stack by 2pt on each side #11739
A borderless TextField that has a background color is 4pt wider than the stack it fills on macOS. It overhangs the stack by 2pt on each side, so its border and background draw outside the column.
Expected: both fields are 300pt wide at x = 0.
Actual: field a is 304pt wide at x = -2. Field b is 300pt wide at x = 0. Geisterhand's /widgets?tree=true reports the same frames.
Cause
15158cd "pad text fields as CSS padding does" (#11665) made textfieldSetBackgroundColor paint the layer and call setDrawsBackground(false) on the field. An NSTextField with no bezel, no border, and no background is shaped like a label to AppKit. AppKit gives it a label's alignmentRectInsets: 2pt on the left and the right. Auto Layout pins the alignment rect to the stack, so the frame grows 2pt past each edge. The layer border and the layer background draw on the frame.
native_textfield_cell.rs sets each field's frame by hand, so it does not see the inset.
Proposed fix
Make PerryTextField and PerrySecureTextField return zero alignmentRectInsets. A field must fill the width it is pinned to, whatever it draws. Add a native test that pins a borderless field with a background to a stack and checks that its frame matches the stack's width.
Activity
fix(ui-macos): keep borderless text and secure fields inside the widt…
fix(ui-macos): keep a Text inside the width it fills (PerryTS#11739)
fix(ui-macos): cover the margins that AppKit reports for a label (Per…
fix(ui-macos): keep text fields and Text inside the width they fill (P…