             setNeedsLayout()
         }
     }
-    
+
+    fileprivate func updateCaptionTextViewWithAttributedCaption() {
+        guard let text = caption else {
+            isCaptionHidden = true
+            return
+        }
+
+        let mutableText = NSMutableAttributedString(attributedString: text)
+        guard mutableText.length > 0 else {
+            isCaptionHidden = true
+            return
+        }
+
+        let pStyle = NSMutableParagraphStyle()
+        pStyle.lineBreakMode = .byWordWrapping
+        pStyle.baseWritingDirection = .natural
+        pStyle.alignment = .center
+        let font = UIFont.wmf_preferredFontForFontFamily(.system, withTextStyle: .footnote, compatibleWithTraitCollection: traitCollection) ?? UIFont.systemFont(ofSize: UIFont.systemFontSize)
+        let attributes: [NSAttributedStringKey : Any] = [NSAttributedStringKey.paragraphStyle: pStyle, NSAttributedStringKey.font: font]
+        mutableText.addAttributes(attributes, range: NSMakeRange(0, mutableText.length))
+        captionTextView.attributedText = mutableText
+
+        isCaptionHidden = false
+    }
+
     @objc var caption: NSAttributedString? {
-        set {
-            guard let text = newValue else {
-                isCaptionHidden = true
-                return
-            }
-            
-            let mutableText = NSMutableAttributedString(attributedString: text)
-            guard mutableText.length > 0 else {
-                isCaptionHidden = true
-                return
-            }
-            
-            let pStyle = NSMutableParagraphStyle()
-            pStyle.lineBreakMode = .byWordWrapping
-            pStyle.baseWritingDirection = .natural
-            pStyle.alignment = .center
-            let attributes = [NSAttributedStringKey.paragraphStyle: pStyle]
-            mutableText.addAttributes(attributes, range: NSMakeRange(0, mutableText.length))
-            captionTextView.attributedText = mutableText
-
-            isCaptionHidden = false
-        }
-
-        get {
-            return captionTextView.attributedText
+        didSet {
+            updateCaptionTextViewWithAttributedCaption()
         }
     }
     

            }
            origin.y += separatorFrame.height
            origin.y += captionSpacing
            let captionFrame = captionTextView.wmf_preferredFrame(at: origin, fitting: widthMinusMargins, alignedBy: semanticContentAttribute, apply: true)
            let insets: UIEdgeInsets = captionTextView.textContainerInset;
            origin.y += insets.top + insets.bottom;
            origin.y += captionFrame.layoutHeight(with: 0)
        }
    
        origin.y += layoutMargins.bottom
        return CGSize(width: size.width, height: origin.y)
    }
}

    public let dismissButtonSpacing: CGFloat = 8
    public let dismissButtonHeight: CGFloat = 32
    @objc public var imageViewDimension: CGFloat = 150
    public let captionSpacing: CGFloat = 20

    open override func setup() {
        layoutMargins = UIEdgeInsets(top: 8, left: 15, bottom: 8, right: 15)
