From: Julien Déramond Date: Mon, 30 Mar 2026 20:26:59 +0000 (+0200) Subject: Use `isRTL` util in Drawer JS code (#42254) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fee29628934248b726ae5993d7ce555d1a38e325;p=thirdparty%2Fbootstrap.git Use `isRTL` util in Drawer JS code (#42254) --- diff --git a/js/src/drawer.js b/js/src/drawer.js index 9f1da6964a..ce71ad0f8c 100644 --- a/js/src/drawer.js +++ b/js/src/drawer.js @@ -12,6 +12,7 @@ import Swipe from './util/swipe.js' import { enableDismissTrigger } from './util/component-functions.js' import { isDisabled, + isRTL, isVisible } from './util/index.js' @@ -114,20 +115,17 @@ class Drawer extends DialogBase { swipeConfig.upCallback = () => this.hide() } else if (element.classList.contains('drawer-end')) { // RTL: swipe left to dismiss end drawer - const isRtl = document.documentElement.dir === 'rtl' - if (isRtl) { + if (isRTL()) { swipeConfig.leftCallback = () => this.hide() } else { swipeConfig.rightCallback = () => this.hide() } + } else if (isRTL()) { + // drawer-start (default): swipe right to dismiss in RTL + swipeConfig.rightCallback = () => this.hide() } else { // drawer-start (default): swipe left to dismiss in LTR - const isRtl = document.documentElement.dir === 'rtl' - if (isRtl) { - swipeConfig.rightCallback = () => this.hide() - } else { - swipeConfig.leftCallback = () => this.hide() - } + swipeConfig.leftCallback = () => this.hide() } this._swipeHelper = new Swipe(element, swipeConfig)