From 460675ba50355008ec887d62ad7c27eff88f71a3 Mon Sep 17 00:00:00 2001 From: Ryan Vogel <89211796+R44VC0RP@users.noreply.github.com> Date: Sat, 21 Nov 2026 10:09:55 -0500 Subject: [PATCH] iOS: the top bar's words sit in the middle of their pill again #2201 put the strip's words on Apple's line, 27 pt above row 1, but Apple's pill reaches 11 pt up into the band iOS draws over a third-party keyboard and Hex's can't, so the words sat high in a 27 pt pill with a big empty band above it (Ryan, from his iPhone). The band stays in non-Apple apps too, and a taller keyboard only raises it, so the words, dividers and Hex mark now centre in the strip: each word in the middle of its pill as Apple's, 5.5 pt below Apple's line. Keeps #2201's full-height pill and #2202's shared line for the mark, which is back to 19 pt. Verified in the iOS 27.2 simulator (iPhone 17 Pro, a third-party host app): 'Help' centred in its pill, the Hex mark on the words' line (bubble-compare.png at hex-kb.i.vogel.dev). --- ios/HEXShared/FullKeyboard/HexKeyViews.swift | 2 +- ios/HEXShared/FullKeyboard/KeyboardLayout.swift | 14 ++++++-------- ios/HEXShared/FullKeyboard/KeyboardStripView.swift | 4 ++-- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/ios/HEXShared/FullKeyboard/HexKeyViews.swift b/ios/HEXShared/FullKeyboard/HexKeyViews.swift index 3e36c3695..05e49cf66 100644 --- a/ios/HEXShared/FullKeyboard/HexKeyViews.swift +++ b/ios/HEXShared/FullKeyboard/HexKeyViews.swift @@ -147,7 +147,7 @@ final class HexKeyControl: UIControl { UIBezierPath(roundedRect: cap, cornerRadius: cap.height / 2).fill() } // In the strip the mark sits on the suggestions' line, as tall as fits around it there - // (16 pt on a phone held upright, where the line is 8 pt below iOS's band), else 19 pt. + // (19 pt, or less where the line leaves less room). let markMidY = inStrip ? (markCenterY ?? cap.midY) : cap.midY let room = inStrip ? 2 * min(markMidY - cap.minY, cap.maxY - markMidY) : cap.height let markSize: CGFloat = inStrip ? min(19, room) : min(19, cap.height * 0.56) diff --git a/ios/HEXShared/FullKeyboard/KeyboardLayout.swift b/ios/HEXShared/FullKeyboard/KeyboardLayout.swift index 5c5ba235a..10eb81464 100644 --- a/ios/HEXShared/FullKeyboard/KeyboardLayout.swift +++ b/ios/HEXShared/FullKeyboard/KeyboardLayout.swift @@ -183,14 +183,12 @@ nonisolated struct KeyboardMetrics: Equatable, Sendable { /// Elsewhere it's the strip less half a point above and below, at most 36 pt. var stripPillHeight: CGFloat { stripHeight == Self.stripBarHeight ? stripHeight : min(stripHeight - 1, 36) } - /// Apple's bar centres its words and dividers 27 pt above row 1's keycaps (iOS 27.2, - /// iPhone 17 Pro: 25.3 pt below the panel's edge, keycaps at 52 pt). In the phone's portrait - /// strip that's 8 pt down, high in the 27 pt the band leaves; Hex centred them in the strip, - /// 5.7 pt below Apple's. Elsewhere the strip is Apple's bar and they centre in it. - static let barTextAboveKeys: CGFloat = 27 - var stripTextCenter: CGFloat { - stripHeight == Self.stripBarHeight ? stripHeight + stripBottom - Self.barTextAboveKeys : stripHeight / 2 - } + /// Where the strip's words, dividers and Hex mark centre: on its middle, so a word sits in + /// the middle of its pill as Apple's does. Apple's words are 27 pt above row 1's keycaps + /// (25.3 pt below the panel's edge on the iPhone 17 Pro, iOS 27.2), but its pill reaches + /// 11 pt up into the band iOS draws over a third-party keyboard; putting Hex's words on + /// Apple's line left them high in a pill that can't (#2201), so they sit 5.5 pt lower. + var stripTextCenter: CGFloat { stripHeight / 2 } /// Apple's keycap corners (iOS 27.2: the same on every iPhone, measured from screenshots /// against keys Hex drew at known radii). diff --git a/ios/HEXShared/FullKeyboard/KeyboardStripView.swift b/ios/HEXShared/FullKeyboard/KeyboardStripView.swift index 8d4b9f16d..ab555bc33 100644 --- a/ios/HEXShared/FullKeyboard/KeyboardStripView.swift +++ b/ios/HEXShared/FullKeyboard/KeyboardStripView.swift @@ -4,8 +4,8 @@ import UIKit /// the iOS 27.2 simulator): SF 17 pt regular in muted ink, slots a third of the keyboard wide, /// 1 × 24 pt dividers ending on the thirds, and a pending autocorrection as a full-slot /// capsule with the divider beside it hidden. iOS's band above the keyboard takes the top of -/// Apple's bar, so the words and dividers sit on Apple's line high in the 27 pt below it -/// (`KeyboardMetrics.stripTextCenter`) and the pills fill it. The centred +/// Apple's bar, so the pills fill the 27 pt below it and the words and dividers centre in it +/// (`KeyboardMetrics.stripTextCenter`). The centred /// `Undo dictation` chip or a status message replaces the slots when needed. @MainActor final class KeyboardStripView: UIView {