Bladeren bron

Fix mirrored alignment in the create meeting popover.

Force left-to-right label layout and anchor field rows to full width so headings remain on the left side of the popup.

Made-with: Cursor
huzaifahayat12 3 maanden geleden
bovenliggende
commit
959e77f27d
1 gewijzigde bestanden met toevoegingen van 22 en 1 verwijderingen
  1. 22 1
      meetings_app/ViewController.swift

+ 22 - 1
meetings_app/ViewController.swift

@@ -4895,20 +4895,28 @@ private final class CreateMeetingPopoverViewController: NSViewController {
     override func loadView() {
         let root = NSView()
         root.translatesAutoresizingMaskIntoConstraints = false
+        root.userInterfaceLayoutDirection = .leftToRight
 
         let stack = NSStackView()
         stack.translatesAutoresizingMaskIntoConstraints = false
         stack.orientation = .vertical
-        stack.alignment = .width
+        stack.alignment = .leading
         stack.spacing = 12
+        stack.userInterfaceLayoutDirection = .leftToRight
 
         let header = NSTextField(labelWithString: "Schedule meeting")
         header.font = NSFont.systemFont(ofSize: 14, weight: .semibold)
         header.textColor = palette.textPrimary
+        header.alignment = .left
+        header.userInterfaceLayoutDirection = .leftToRight
+        header.baseWritingDirection = .leftToRight
 
         let titleLabel = NSTextField(labelWithString: "Title")
         titleLabel.font = typography.fieldLabel
         titleLabel.textColor = palette.textSecondary
+        titleLabel.alignment = .left
+        titleLabel.userInterfaceLayoutDirection = .leftToRight
+        titleLabel.baseWritingDirection = .leftToRight
 
         let titleShell = NSView()
         titleShell.translatesAutoresizingMaskIntoConstraints = false
@@ -4945,6 +4953,9 @@ private final class CreateMeetingPopoverViewController: NSViewController {
         let startLabel = NSTextField(labelWithString: "Start")
         startLabel.font = typography.fieldLabel
         startLabel.textColor = palette.textSecondary
+        startLabel.alignment = .left
+        startLabel.userInterfaceLayoutDirection = .leftToRight
+        startLabel.baseWritingDirection = .leftToRight
 
         let pickerShell = NSView()
         pickerShell.translatesAutoresizingMaskIntoConstraints = false
@@ -4976,6 +4987,9 @@ private final class CreateMeetingPopoverViewController: NSViewController {
         let durationLabel = NSTextField(labelWithString: "Duration (min)")
         durationLabel.font = typography.fieldLabel
         durationLabel.textColor = palette.textSecondary
+        durationLabel.alignment = .left
+        durationLabel.userInterfaceLayoutDirection = .leftToRight
+        durationLabel.baseWritingDirection = .leftToRight
 
         let durationShell = NSView()
         durationShell.translatesAutoresizingMaskIntoConstraints = false
@@ -5021,6 +5035,9 @@ private final class CreateMeetingPopoverViewController: NSViewController {
         let notesLabel = NSTextField(labelWithString: "Notes")
         notesLabel.font = typography.fieldLabel
         notesLabel.textColor = palette.textSecondary
+        notesLabel.alignment = .left
+        notesLabel.userInterfaceLayoutDirection = .leftToRight
+        notesLabel.baseWritingDirection = .leftToRight
 
         let notesScroll = NSScrollView()
         notesScroll.translatesAutoresizingMaskIntoConstraints = false
@@ -5086,6 +5103,10 @@ private final class CreateMeetingPopoverViewController: NSViewController {
             stack.trailingAnchor.constraint(equalTo: root.trailingAnchor, constant: -14),
             stack.topAnchor.constraint(equalTo: root.topAnchor, constant: 12),
             stack.bottomAnchor.constraint(equalTo: root.bottomAnchor, constant: -12),
+            titleShell.widthAnchor.constraint(equalTo: stack.widthAnchor),
+            timeRow.widthAnchor.constraint(equalTo: stack.widthAnchor),
+            notesScroll.widthAnchor.constraint(equalTo: stack.widthAnchor),
+            error.widthAnchor.constraint(equalTo: stack.widthAnchor),
             actions.widthAnchor.constraint(equalTo: stack.widthAnchor)
         ])