Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Avoid iOS block appender focus loop #44988

Closed
wants to merge 5 commits into from

Commits on Oct 14, 2022

  1. fix: Avoid iOS block appender focus loop

    The focus callback triggered by Aztec-based programmatic focus events
    can result in focus loops between rich text elements.
    
    Android: This intentional no-op function prevents focus loops
    originating when the native Aztec module programmatically focuses the
    instance. The no-op is explicitly passed as an `onFocus` prop to avoid
    future prop spreading from inadvertently introducing focus loops. The
    user-facing focus of the element is handled by `onPress` instead.
    
    See: wordpress-mobile/gutenberg-mobile#302
    
    iOS: Programmatic focus from the native Aztec module is required to
    ensure the React-based `TextStateInput` ref is properly set when focus
    is *returned* to an instance, e.g. dismissing a bottom sheet. If the ref
    is not updated, attempts to dismiss the keyboard via the `ToolbarButton`
    will fail.
    
    See: wordpress-mobile/gutenberg-mobile#702
    
    The Android keyboard is, likely erroneously, already dismissed in the
    contexts where programmatic focus may be required on iOS.
    
    - #28748
    - #29048
    - wordpress-mobile/WordPress-Android#16167
    
    Programmatic swapping focus from element to another often leads to focus
    loops, only delegate the programmatic focus if there are no elements
    focused.
    
    See: wordpress-mobile/WordPress-iOS#18783
    dcalhoun committed Oct 14, 2022
    Configuration menu
    Copy the full SHA
    de1d880 View commit details
    Browse the repository at this point in the history
  2. docs: Add changelog entry

    dcalhoun committed Oct 14, 2022
    Configuration menu
    Copy the full SHA
    11a04e2 View commit details
    Browse the repository at this point in the history

Commits on Oct 31, 2022

  1. fix: Programmatic Aztec input focus only updates internal ref

    Programmatically swapping input focus creates an infinite loop if the
    user taps a different input in between the programmatic focus and
    the resulting update to the React Native TextInputState focused element
    ref. To mitigate this, the Aztec now updates the focused element ref,
    but does not call the native focus methods.
    
    See: wordpress-mobile/WordPress-iOS#18783
    dcalhoun committed Oct 31, 2022
    Configuration menu
    Copy the full SHA
    7a01503 View commit details
    Browse the repository at this point in the history

Commits on Nov 1, 2022

  1. fix: Hide keyboard button forcibly dismisses the virtual keyboard

    Due to race conditions between Aztec focus effects and React Native
    gesture handlers, it is possible to select one block while placing focus
    in a different block's text input. If the actively select block is not a
    rich text field, tapping the dismiss keyboard button will not dismiss
    the keyboard via clearing the selected block, as a non-rich-text block
    does not trigger a blur event. So, this change explicitly dismisses the
    keyboard rather than relying upon the selected block clear.
    
    This is a hack. Ideally, the Aztec call loop is improved so that it is
    not possible to select/focus more than one block.
    dcalhoun committed Nov 1, 2022
    Configuration menu
    Copy the full SHA
    2ea6b0e View commit details
    Browse the repository at this point in the history

Commits on Nov 2, 2022

  1. Merge branch 'trunk' of github.com:WordPress/gutenberg into fix/ios-b…

    …lock-appender-focus-loop
    dcalhoun committed Nov 2, 2022
    Configuration menu
    Copy the full SHA
    fda398e View commit details
    Browse the repository at this point in the history