             trailingAnchor = safeAreaLayoutGuide.trailingAnchor
         }
 
+        ///Overflow toggle item
+
         let overflowTrailingConstraint = overflowToggleItem.trailingAnchor.constraint(equalTo: trailingAnchor)
         overflowTrailingConstraint.priority = .defaultLow
 
+        //Create the correct `overflowLeadingConstraint` for the current layout direction.
+        let overflowLeadingConstraint: NSLayoutConstraint
+        switch layoutDirection {
+        case .leftToRight:
+            overflowLeadingConstraint = overflowToggleItem.leadingAnchor.constraint(greaterThanOrEqualTo: scrollableStackView.trailingAnchor)
+        case .rightToLeft:
+            overflowLeadingConstraint = NSLayoutConstraint(
+                item: overflowToggleItem,
+                attribute: .leading,
+                relatedBy: .greaterThanOrEqual,
+                toItem: scrollableStackView,
+                attribute: .trailing,
+                multiplier: -1,
+                constant: 0
+            )
+            self.overflowToggleItemRTLLeadingConstraint = overflowLeadingConstraint
+        }
+
+        ///Trailing item
+
         let trailingItemTrailingConstraint = trailingItemContainer.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -Constants.trailingButtonMargin)
         trailingItemTrailingConstraint.priority = .defaultLow
+
+        //Create the correct `trailingItemLeadingConstraint` for the current layout direction.
+        let trailingItemLeadingConstraint: NSLayoutConstraint
+        switch layoutDirection {
+        case .leftToRight:
+            trailingItemLeadingConstraint = trailingItemContainer.leadingAnchor.constraint(greaterThanOrEqualTo: scrollableStackView.trailingAnchor)
+        case .rightToLeft:
+            trailingItemLeadingConstraint = trailingItemContainer.leadingAnchor.constraint(greaterThanOrEqualTo: scrollableStackView.leadingAnchor)
+        }
 
         NSLayoutConstraint.activate([
             overflowToggleItem.topAnchor.constraint(equalTo: topAnchor),
             overflowToggleItem.bottomAnchor.constraint(equalTo: scrollView.bottomAnchor),
-            overflowToggleItem.leadingAnchor.constraint(greaterThanOrEqualTo: scrollableStackView.trailingAnchor),
+            overflowLeadingConstraint,
             overflowTrailingConstraint
         ])
 
         NSLayoutConstraint.activate([
             trailingItemContainer.topAnchor.constraint(equalTo: topAnchor),
             trailingItemContainer.bottomAnchor.constraint(equalTo: scrollView.bottomAnchor),
-            trailingItemContainer.leadingAnchor.constraint(greaterThanOrEqualTo: scrollableStackView.trailingAnchor),
+            trailingItemLeadingConstraint,
             trailingItemTrailingConstraint
         ])
 

            }
        })
    }
    
    @IBAction func handleButtonTouch(_ sender: FormatBarItem) {
        formatter?.formatBarTouchesBegan(self)
    }

    fileprivate func updateOverflowToggleItemVisibility() {
        let hasOverflowItems = !overflowItems.isEmpty
        overflowToggleItem.isHidden = !hasOverflowItems || trailingItem != nil
    }

    /// Updates the overflowToggleItemRTLLeadingConstraint with the correct value. On LTR layout this function does nothing.
    ///
    private func updateOverflowToggleItemRTLConstraints() {
        overflowToggleItemRTLLeadingConstraint?.constant = scrollableStackView.frame.width - frame.width
    }

    @available(iOS 11.0, *)
