Commit 07c7646a1e

07c7646a1edd8e6f16f3dae82da19a335ed2b146

parent: 71866044e3

Verified · cmc

cmc <hello@cleberg.net> · 2026-11-22 21:17 UTC

iOS key bar: 44 pt buttons and a height that follows the text size

Ref #221

Layout: unified · split

Changed files (2)
Sources/OrgstarMobile/EditorScreen.swift +34 −5 · view
@@ -805,12 +805,20 @@ struct EditorTextView: UIViewRepresentable {
805805 let palette: () -> Void
806806
807807 func makeUIView(context: Context) -> UITextView {
808 let bar = UIHostingController(rootView: KeyBar(editor: editor, palette: palette))
809 bar.view.frame = CGRect(x: 0, y: 0, width: 400, height: 48)
808 let bar = UIHostingController(rootView: KeyBar(editor: editor, palette: palette).dynamicTypeSize(...KeyBar.largestSize))
809 bar.view.frame = CGRect(x: 0, y: 0, width: 400, height: 2 * KeyBar.padding + KeyBar.target)
810810 bar.view.backgroundColor = .clear
811 bar.sizingOptions = []
811 // As tall as its buttons: the input accessory takes the intrinsic height.
812 bar.sizingOptions = .intrinsicContentSize
813 bar.safeAreaRegions = []
814 bar.view.autoresizingMask = .flexibleHeight
812815 view.inputAccessoryView = bar.view
813816 context.coordinator.bar = bar
817 // The bar's height follows the text size.
818 view.registerForTraitChanges([UITraitPreferredContentSizeCategory.self]) { (view: UITextView, _) in
819 view.inputAccessoryView?.invalidateIntrinsicContentSize()
820 view.reloadInputViews()
821 }
814822 return view
815823 }
816824
@@ -852,6 +860,12 @@ struct KeyBar: View {
852860 ("Code", "chevron.left.forwardslash.chevron.right", "org.emphasize.code"),
853861 ]
854862
863 /// The bar's buttons are at least 44 points square, scaled with the text size up to here.
864 static let largestSize = DynamicTypeSize.accessibility2
865 static let target: CGFloat = 44
866 static let padding: CGFloat = 4
867 @ScaledMetric(relativeTo: .body) private var size = KeyBar.target
868
855869 var body: some View {
856870 ScrollView(.horizontal, showsIndicators: false) {
857871 HStack(spacing: 4) {
@@ -870,14 +884,29 @@ struct KeyBar: View {
870884 Button("Hide keyboard", systemImage: "keyboard.chevron.compact.down") { editor.textView.resignFirstResponder() }
871885 }
872886 .labelStyle(.iconOnly)
873 .buttonStyle(.bordered)
887 .buttonStyle(KeyStyle(size: size))
874888 .padding(.horizontal, 8)
875 .padding(.vertical, 6)
889 .padding(.vertical, Self.padding)
876890 }
877891 .background(.bar)
878892 }
879893}
880894
895/// A key bar button: a tinted symbol on a capsule, at least `size` square.
896private struct KeyStyle: ButtonStyle {
897 let size: CGFloat
898
899 func makeBody(configuration: Configuration) -> some View {
900 configuration.label
901 .foregroundStyle(.tint)
902 .padding(.horizontal, 10)
903 .frame(minWidth: size, minHeight: size)
904 .background(.fill.tertiary, in: .capsule)
905 .opacity(configuration.isPressed ? 0.5 : 1)
906 .contentShape(.capsule)
907 }
908}
909
881910/// A command's question: text with choices, a date, or fast selection by keys.
882911struct PromptSheet: View {
883912 let prompt: Prompt
docs/manual/guide/14-ios.org +1 −1 · view
@@ -118,7 +118,7 @@ Table columns with width cookies narrow as on the Mac: =#+STARTUP: shrink= narro
118118
119119** The key bar
120120
121A bar above the on-screen keyboard has buttons for Org's keys. Each does what its Emacs key does at the caret, so the arrows promote and demote headings, indent list items, or move table columns, depending on where the caret is. Scroll the bar sideways for more.
121A bar above the on-screen keyboard has buttons for Org's keys. Each does what its Emacs key does at the caret, so the arrows promote and demote headings, indent list items, or move table columns, depending on where the caret is. Scroll the bar sideways for more. Its buttons are at least 44 points high and grow with the text size up to the second accessibility size.
122122
123123| Button | Key |
124124|----------------------+-------------|
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form