     @objc
     private func keyboardDidHide(notification: Notification) {
         if let firstResponder = view.firstResponder() {
-            let firstResponderFrame = scrollView.convert(firstResponder.frame, from: firstResponder)
+            let firstResponderFrame = scrollView.convert(firstResponder.bounds, from: firstResponder).insetBy(
+                dx: -Constants.keyboardAvoidanceEdgePadding,
+                dy: -Constants.keyboardAvoidanceEdgePadding
+            )
             scrollView.scrollRectToVisible(firstResponderFrame, animated: true)
             scrollView.contentInset.bottom = .zero
         }

/// For internal SDK use only
@objc(STP_Internal_BottomSheetViewController)
class BottomSheetViewController: UIViewController, PanModalPresentable {
    // MARK: - Views
    private lazy var scrollView: UIScrollView = {
        let scrollView = UIScrollView()

        }
        
        if let firstResponder = view.firstResponder() {
            let firstResponderFrame = scrollView.convert(firstResponder.bounds, from: firstResponder).insetBy(
                dx: -Constants.keyboardAvoidanceEdgePadding,
                dy: -Constants.keyboardAvoidanceEdgePadding
            )
            scrollView.scrollRectToVisible(firstResponderFrame, animated: true)
        }
    }
