Skip to content

Fix Gutenberg keyboard hide observer to handle dismissal notifications#25544

Merged
crazytonyli merged 2 commits intomokagio/swiftlint-unneeded-parens-closure-argfrom
copilot/sub-pr-25521
May 8, 2026
Merged

Fix Gutenberg keyboard hide observer to handle dismissal notifications#25544
crazytonyli merged 2 commits intomokagio/swiftlint-unneeded-parens-closure-argfrom
copilot/sub-pr-25521

Conversation

Copy link
Copy Markdown

Copilot AI commented May 8, 2026

This stacked PR addresses feedback from the SwiftLint follow-up thread by fixing a pre-existing observer wiring bug in GutenbergViewController. The hide observer was incorrectly subscribed to keyboard show notifications, preventing the hide path from running on keyboard dismissal.

  • Observer wiring

    • Changed keyboardHideObserver to subscribe to UIResponder.keyboardDidHideNotification instead of UIResponder.keyboardDidShowNotification.
  • Behavioral impact

    • Restores expected keyboard-dismiss handling so editor constraints can be updated when the keyboard hides.
keyboardHideObserver = NotificationCenter.default.addObserver(
    forName: UIResponder.keyboardDidHideNotification,
    object: nil,
    queue: .main
) { [weak self] notification in
    if let self, let keyboardRect = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect {
        self.keyboardFrame = keyboardRect
        self.updateConstraintsToAvoidKeyboard(frame: keyboardRect)
    }
}

@dangermattic
Copy link
Copy Markdown
Collaborator

1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

Copilot AI changed the title [WIP] [WIP] Address feedback on enabling SwiftLint rule: unneeded_parentheses_in_closure_argument Fix Gutenberg keyboard hide observer to handle dismissal notifications May 8, 2026
Copilot finished work on behalf of mokagio May 8, 2026 08:10
Copilot AI requested a review from mokagio May 8, 2026 08:10
@wpmobilebot
Copy link
Copy Markdown
Contributor

App Icon📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack
ConfigurationRelease-Alpha
Build Number32179
VersionPR #25544
Bundle IDcom.jetpack.alpha
Commit0cf5b6f
Installation URL746qmu4rk8qbg
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot
Copy link
Copy Markdown
Contributor

App Icon📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress
ConfigurationRelease-Alpha
Build Number32179
VersionPR #25544
Bundle IDorg.wordpress.alpha
Commit0cf5b6f
Installation URL7282e8kbjtpd8
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

}
}
keyboardHideObserver = NotificationCenter.default.addObserver(forName: UIResponder.keyboardDidShowNotification, object: nil, queue: .main) { [weak self] notification in
keyboardHideObserver = NotificationCenter.default.addObserver(forName: UIResponder.keyboardDidHideNotification, object: nil, queue: .main) { [weak self] notification in
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@crazytonyli @jkmassel this makes sense to me: The hide observer should subscribe to the hide notification. But you'll sure have more context on the choices of implementation.

@mokagio mokagio marked this pull request as ready for review May 8, 2026 09:24
Copilot AI review requested due to automatic review settings May 8, 2026 09:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes keyboard dismissal handling in the Gutenberg editor by correcting a miswired notification observer so constraint updates run when the keyboard actually hides.

Changes:

  • Updated keyboardHideObserver to subscribe to UIResponder.keyboardDidHideNotification (instead of keyboardDidShowNotification).
  • Restores the keyboard-dismiss path so updateConstraintsToAvoidKeyboard is invoked on dismissal.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@crazytonyli crazytonyli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a copy-pasta error.

@crazytonyli crazytonyli merged commit 368e894 into mokagio/swiftlint-unneeded-parens-closure-arg May 8, 2026
28 checks passed
@crazytonyli crazytonyli deleted the copilot/sub-pr-25521 branch May 8, 2026 09:58
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.

6 participants