Skip to content

iOS: fix status-bar tap scroll-to-top on device (#3589)#4857

Merged
shai-almog merged 1 commit intomasterfrom
fix/3589-ios-status-bar-scroll-to-top
May 3, 2026
Merged

iOS: fix status-bar tap scroll-to-top on device (#3589)#4857
shai-almog merged 1 commit intomasterfrom
fix/3589-ios-status-bar-scroll-to-top

Conversation

@shai-almog
Copy link
Copy Markdown
Collaborator

Summary

  • Fixes iOS status-bar tap not scrolling to top on real devices (#3589). The CN1 simulator was already working because it dispatches a normal touch to the StatusBar container; iOS swallows that touch and only delivers the action via scrollViewShouldScrollToTop: to one UIScrollView in the window.
  • The hidden proxy UIScrollView had two latent bugs that broke that delivery on device: contentSize (1x2) was smaller than its full-screen frame so iOS treated it as not actually scrollable, and userInteractionEnabled = NO excludes the view from scroll-to-top dispatch on recent iOS versions.
  • Even with the proxy fixed, any on-screen WKWebView / UIWebView / UITextView (whose internal scroll views default to scrollsToTop = YES) created an ambiguity that caused iOS to deliver the message to no one.

Changes

  • CodenameOne_GLViewController.m
    • New CN1StatusBarTapProxyView UIScrollView subclass that returns NO from pointInside:withEvent: so taps still pass through to the GL view, and overrides layoutSubviews to keep contentSize one point taller than its bounds across rotations.
    • cn1InstallStatusBarTapProxy now creates that subclass with userInteractionEnabled = YES, idempotently re-attaches if already created, and is also called from viewDidAppear: so native peers added after viewDidLoad don't bury the proxy.
    • scrollsToTop = NO on the multiline editing CN1UITextView.
  • IOSNative.mscrollsToTop = NO on the embedded scrollView of both UIWebView and WKWebView.

Test plan

  • After the next iOS-port build is published, run the repro from Tapping a button in the StatusBar does not work on iOS device (iPhone Xr) #3589 on a real iPhone (paintsTitleBarBool:true, statusBarScrollsUpBool:true, a Form with 30 Labels) and confirm tapping the status bar scrolls back to the top.
  • Repeat with a BrowserComponent on screen and with a focused multi-line TextArea — both used to silently disable the status-bar tap because of the multiple-scroll-views conflict.
  • Verify rotation between portrait and landscape doesn't break the behavior.
  • Confirm normal touch handling on the GL view (toolbar buttons, lists) is unchanged — the proxy view is full-screen but pointInside: returns NO so it must not consume any touches.

🤖 Generated with Claude Code

The hidden UIScrollView used to receive the iOS status-bar tap
(scrollViewShouldScrollToTop:) was effectively invisible to the system
on real devices for two reasons: its contentSize (1x2) was smaller than
its full-screen frame so iOS treated it as not actually scrollable, and
userInteractionEnabled was NO which excludes the view from scroll-to-top
dispatch on recent iOS versions. Even when those were addressed, any
on-screen WKWebView/UIWebView/UITextView (whose internal scroll views
default to scrollsToTop=YES) created an ambiguity that caused iOS to
deliver the message to no one.

- Introduce a CN1StatusBarTapProxyView UIScrollView subclass that
  returns NO from pointInside: so taps still fall through to the GL
  view, and keeps contentSize one point taller than its bounds in
  layoutSubviews so the scroll view stays scrollable across rotations.
- Recreate the proxy with userInteractionEnabled=YES and re-attach /
  bring it to the front from viewDidAppear: so peers added after
  viewDidLoad don't bury it.
- Set scrollsToTop=NO on the editing CN1UITextView and on UIWebView /
  WKWebView's embedded scrollViews so they don't compete with the proxy.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 3, 2026

✅ Continuous Quality Report

Test & Coverage

Static Analysis

  • SpotBugs [Report archive]
    • ByteCodeTranslator: 0 findings (no issues)
    • android: 0 findings (no issues)
    • codenameone-maven-plugin: 0 findings (no issues)
    • core-unittests: 0 findings (no issues)
    • ios: 0 findings (no issues)
  • PMD: 0 findings (no issues) [Report archive]
  • Checkstyle: 0 findings (no issues) [Report archive]

Generated automatically by the PR CI workflow.

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 3, 2026

iOS screenshot updates

Compared 86 screenshots: 85 matched, 1 updated.

  • landscape — updated screenshot. Screenshot differs (2556x1179 px, bit depth 8).

    landscape
    Preview info: Preview provided by instrumentation.
    Full-resolution PNG saved as landscape.png in workflow artifacts.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 225 seconds

Build and Run Timing

Metric Duration
Simulator Boot 65000 ms
Simulator Boot (Run) 0 ms
App Install 16000 ms
App Launch 5000 ms
Test Execution 242000 ms

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 1738.000 ms
Base64 CN1 encode 1859.000 ms
Base64 encode ratio (CN1/native) 1.070x (7.0% slower)
Base64 native decode 1208.000 ms
Base64 CN1 decode 1406.000 ms
Base64 decode ratio (CN1/native) 1.164x (16.4% slower)
Base64 SIMD encode 544.000 ms
Base64 encode ratio (SIMD/native) 0.313x (68.7% faster)
Base64 encode ratio (SIMD/CN1) 0.293x (70.7% faster)
Base64 SIMD decode 614.000 ms
Base64 decode ratio (SIMD/native) 0.508x (49.2% faster)
Base64 decode ratio (SIMD/CN1) 0.437x (56.3% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 59.000 ms
Image createMask (SIMD on) 9.000 ms
Image createMask ratio (SIMD on/off) 0.153x (84.7% faster)
Image applyMask (SIMD off) 187.000 ms
Image applyMask (SIMD on) 118.000 ms
Image applyMask ratio (SIMD on/off) 0.631x (36.9% faster)
Image modifyAlpha (SIMD off) 156.000 ms
Image modifyAlpha (SIMD on) 62.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.397x (60.3% faster)
Image modifyAlpha removeColor (SIMD off) 240.000 ms
Image modifyAlpha removeColor (SIMD on) 83.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.346x (65.4% faster)
Image PNG encode (SIMD off) 986.000 ms
Image PNG encode (SIMD on) 858.000 ms
Image PNG encode ratio (SIMD on/off) 0.870x (13.0% faster)
Image JPEG encode 510.000 ms

@shai-almog shai-almog merged commit cbe662e into master May 3, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant