From f71b587047c7a5eb5542ed61eb89fc51d50f573c Mon Sep 17 00:00:00 2001 From: Rajesh Kumar Date: Sat, 10 Apr 2021 21:58:09 +0530 Subject: [PATCH] added autohide feature in offcanvas --- js/src/offcanvas.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/src/offcanvas.js b/js/src/offcanvas.js index 02b0b58a9191..e9a720aa15ee 100644 --- a/js/src/offcanvas.js +++ b/js/src/offcanvas.js @@ -37,13 +37,15 @@ const ESCAPE_KEY = 'Escape' const Default = { backdrop: true, keyboard: true, - scroll: false + scroll: false, + autoHide: true } const DefaultType = { backdrop: 'boolean', keyboard: 'boolean', - scroll: 'boolean' + scroll: 'boolean', + autoHide: 'boolean' } const CLASS_NAME_BACKDROP_BODY = 'offcanvas-backdrop' @@ -204,7 +206,7 @@ class Offcanvas extends BaseComponent { EventHandler.on(document, EVENT_CLICK_DATA_API, event => { const target = SelectorEngine.findOne(getSelectorFromElement(event.target)) - if (!this._element.contains(event.target) && target !== this._element) { + if (!this._element.contains(event.target) && target !== this._element && this._config.autoHide) { this.hide() } })