From fca04c07131a81e625a516cf7b98a8c7df0df1c1 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Fri, 13 May 2022 09:07:23 +0300 Subject: Dist --- js/dist/tab.js | 441 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 227 insertions(+), 214 deletions(-) (limited to 'js/dist/tab.js') diff --git a/js/dist/tab.js b/js/dist/tab.js index c3c24b75c..bf7c991b4 100644 --- a/js/dist/tab.js +++ b/js/dist/tab.js @@ -1,13 +1,13 @@ /*! - * Bootstrap tab.js v5.1.3 (https://getbootstrap.com/) - * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) + * Bootstrap tab.js v5.2.0-beta1 (https://getbootstrap.com/) + * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/event-handler.js'), require('./dom/selector-engine.js'), require('./base-component.js')) : - typeof define === 'function' && define.amd ? define(['./dom/event-handler', './dom/selector-engine', './base-component'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tab = factory(global.EventHandler, global.SelectorEngine, global.Base)); -})(this, (function (EventHandler, SelectorEngine, BaseComponent) { 'use strict'; + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./util/index'), require('./dom/event-handler'), require('./dom/selector-engine'), require('./base-component')) : + typeof define === 'function' && define.amd ? define(['./util/index', './dom/event-handler', './dom/selector-engine', './base-component'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tab = factory(global.Index, global.EventHandler, global.SelectorEngine, global.BaseComponent)); +})(this, (function (index, EventHandler, SelectorEngine, BaseComponent) { 'use strict'; const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e }; @@ -17,270 +17,278 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.3): util/index.js + * Bootstrap (v5.2.0-beta1): tab.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ - - const getSelector = element => { - let selector = element.getAttribute('data-bs-target'); - - if (!selector || selector === '#') { - let hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes, - // so everything starting with `#` or `.`. If a "real" URL is used as the selector, - // `document.querySelector` will rightfully complain it is invalid. - // See https://github.com/twbs/bootstrap/issues/32273 - - if (!hrefAttr || !hrefAttr.includes('#') && !hrefAttr.startsWith('.')) { - return null; - } // Just in case some CMS puts out a full URL with the anchor appended - - - if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) { - hrefAttr = `#${hrefAttr.split('#')[1]}`; - } - - selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; - } - - return selector; - }; - - const getElementFromSelector = element => { - const selector = getSelector(element); - return selector ? document.querySelector(selector) : null; - }; - - const isDisabled = element => { - if (!element || element.nodeType !== Node.ELEMENT_NODE) { - return true; - } - - if (element.classList.contains('disabled')) { - return true; - } - - if (typeof element.disabled !== 'undefined') { - return element.disabled; - } - - return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false'; - }; /** - * Trick to restart an element's animation - * - * @param {HTMLElement} element - * @return void - * - * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation - */ - - - const reflow = element => { - // eslint-disable-next-line no-unused-expressions - element.offsetHeight; - }; - - const getjQuery = () => { - const { - jQuery - } = window; - - if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) { - return jQuery; - } - - return null; - }; - - const DOMContentLoadedCallbacks = []; - - const onDOMContentLoaded = callback => { - if (document.readyState === 'loading') { - // add listener on the first call when the document is in loading state - if (!DOMContentLoadedCallbacks.length) { - document.addEventListener('DOMContentLoaded', () => { - DOMContentLoadedCallbacks.forEach(callback => callback()); - }); - } - - DOMContentLoadedCallbacks.push(callback); - } else { - callback(); - } - }; - - const defineJQueryPlugin = plugin => { - onDOMContentLoaded(() => { - const $ = getjQuery(); - /* istanbul ignore if */ - - if ($) { - const name = plugin.NAME; - const JQUERY_NO_CONFLICT = $.fn[name]; - $.fn[name] = plugin.jQueryInterface; - $.fn[name].Constructor = plugin; - - $.fn[name].noConflict = () => { - $.fn[name] = JQUERY_NO_CONFLICT; - return plugin.jQueryInterface; - }; - } - }); - }; - - /** - * -------------------------------------------------------------------------- - * Bootstrap (v5.1.3): tab.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) - * -------------------------------------------------------------------------- - */ - /** - * ------------------------------------------------------------------------ * Constants - * ------------------------------------------------------------------------ */ const NAME = 'tab'; const DATA_KEY = 'bs.tab'; const EVENT_KEY = `.${DATA_KEY}`; - const DATA_API_KEY = '.data-api'; const EVENT_HIDE = `hide${EVENT_KEY}`; const EVENT_HIDDEN = `hidden${EVENT_KEY}`; const EVENT_SHOW = `show${EVENT_KEY}`; const EVENT_SHOWN = `shown${EVENT_KEY}`; - const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`; - const CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu'; + const EVENT_CLICK_DATA_API = `click${EVENT_KEY}`; + const EVENT_KEYDOWN = `keydown${EVENT_KEY}`; + const EVENT_LOAD_DATA_API = `load${EVENT_KEY}`; + const ARROW_LEFT_KEY = 'ArrowLeft'; + const ARROW_RIGHT_KEY = 'ArrowRight'; + const ARROW_UP_KEY = 'ArrowUp'; + const ARROW_DOWN_KEY = 'ArrowDown'; const CLASS_NAME_ACTIVE = 'active'; const CLASS_NAME_FADE = 'fade'; const CLASS_NAME_SHOW = 'show'; - const SELECTOR_DROPDOWN = '.dropdown'; - const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group'; - const SELECTOR_ACTIVE = '.active'; - const SELECTOR_ACTIVE_UL = ':scope > li > .active'; - const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]'; + const CLASS_DROPDOWN = 'dropdown'; const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'; - const SELECTOR_DROPDOWN_ACTIVE_CHILD = ':scope > .dropdown-menu .active'; + const SELECTOR_DROPDOWN_MENU = '.dropdown-menu'; + const SELECTOR_DROPDOWN_ITEM = '.dropdown-item'; + const NOT_SELECTOR_DROPDOWN_TOGGLE = ':not(.dropdown-toggle)'; + const SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]'; + const SELECTOR_OUTER = '.nav-item, .list-group-item'; + const SELECTOR_INNER = `.nav-link${NOT_SELECTOR_DROPDOWN_TOGGLE}, .list-group-item${NOT_SELECTOR_DROPDOWN_TOGGLE}, [role="tab"]${NOT_SELECTOR_DROPDOWN_TOGGLE}`; + const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]'; // todo:v6: could be only `tab` + + const SELECTOR_INNER_ELEM = `${SELECTOR_INNER}, ${SELECTOR_DATA_TOGGLE}`; + const SELECTOR_DATA_TOGGLE_ACTIVE = `.${CLASS_NAME_ACTIVE}[data-bs-toggle="tab"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="pill"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="list"]`; /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ + * Class definition */ class Tab extends BaseComponent__default.default { - // Getters + constructor(element) { + super(element); + this._parent = this._element.closest(SELECTOR_TAB_PANEL); + + if (!this._parent) { + return; // todo: should Throw exception on v6 + // throw new TypeError(`${element.outerHTML} has not a valid parent ${SELECTOR_INNER_ELEM}`) + } // Set up initial aria attributes + + + this._setInitialAttributes(this._parent, this._getChildren()); + + EventHandler__default.default.on(this._element, EVENT_KEYDOWN, event => this._keydown(event)); + } // Getters + + static get NAME() { return NAME; } // Public show() { - if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE)) { - return; - } + // Shows this elem and deactivate the active sibling if exists + const innerElem = this._element; - let previous; - const target = getElementFromSelector(this._element); + if (this._elemIsActive(innerElem)) { + return; + } // Search for active tab on same parent to deactivate it - const listElement = this._element.closest(SELECTOR_NAV_LIST_GROUP); - if (listElement) { - const itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE; - previous = SelectorEngine__default.default.find(itemSelector, listElement); - previous = previous[previous.length - 1]; - } + const active = this._getActiveElem(); - const hideEvent = previous ? EventHandler__default.default.trigger(previous, EVENT_HIDE, { - relatedTarget: this._element + const hideEvent = active ? EventHandler__default.default.trigger(active, EVENT_HIDE, { + relatedTarget: innerElem }) : null; - const showEvent = EventHandler__default.default.trigger(this._element, EVENT_SHOW, { - relatedTarget: previous + const showEvent = EventHandler__default.default.trigger(innerElem, EVENT_SHOW, { + relatedTarget: active }); - if (showEvent.defaultPrevented || hideEvent !== null && hideEvent.defaultPrevented) { + if (showEvent.defaultPrevented || hideEvent && hideEvent.defaultPrevented) { return; } - this._activate(this._element, listElement); + this._deactivate(active, innerElem); + + this._activate(innerElem, active); + } // Private + + + _activate(element, relatedElem) { + if (!element) { + return; + } + + element.classList.add(CLASS_NAME_ACTIVE); + + this._activate(index.getElementFromSelector(element)); // Search and activate/show the proper section + + + const isAnimated = element.classList.contains(CLASS_NAME_FADE); const complete = () => { - EventHandler__default.default.trigger(previous, EVENT_HIDDEN, { - relatedTarget: this._element + if (isAnimated) { + // todo: maybe is redundant + element.classList.add(CLASS_NAME_SHOW); + } + + if (element.getAttribute('role') !== 'tab') { + return; + } + + element.focus(); + element.removeAttribute('tabindex'); + element.setAttribute('aria-selected', true); + + this._toggleDropDown(element, true); + + EventHandler__default.default.trigger(element, EVENT_SHOWN, { + relatedTarget: relatedElem }); - EventHandler__default.default.trigger(this._element, EVENT_SHOWN, { - relatedTarget: previous + }; + + this._queueCallback(complete, element, isAnimated); + } + + _deactivate(element, relatedElem) { + if (!element) { + return; + } + + element.classList.remove(CLASS_NAME_ACTIVE); + element.blur(); + + this._deactivate(index.getElementFromSelector(element)); // Search and deactivate the shown section too + + + const isAnimated = element.classList.contains(CLASS_NAME_FADE); + + const complete = () => { + if (isAnimated) { + // todo maybe is redundant + element.classList.remove(CLASS_NAME_SHOW); + } + + if (element.getAttribute('role') !== 'tab') { + return; + } + + element.setAttribute('aria-selected', false); + element.setAttribute('tabindex', '-1'); + + this._toggleDropDown(element, false); + + EventHandler__default.default.trigger(element, EVENT_HIDDEN, { + relatedTarget: relatedElem }); }; - if (target) { - this._activate(target, target.parentNode, complete); - } else { - complete(); + this._queueCallback(complete, element, isAnimated); + } + + _keydown(event) { + if (![ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY].includes(event.key)) { + return; } - } // Private + event.stopPropagation(); // stopPropagation/preventDefault both added to support up/down keys without scrolling the page + + event.preventDefault(); + const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key); + const nextActiveElement = index.getNextActiveElement(this._getChildren().filter(element => !index.isDisabled(element)), event.target, isNext, true); + + if (nextActiveElement) { + Tab.getOrCreateInstance(nextActiveElement).show(); + } + } - _activate(element, container, callback) { - const activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? SelectorEngine__default.default.find(SELECTOR_ACTIVE_UL, container) : SelectorEngine__default.default.children(container, SELECTOR_ACTIVE); - const active = activeElements[0]; - const isTransitioning = callback && active && active.classList.contains(CLASS_NAME_FADE); + _getChildren() { + // collection of inner elements + return SelectorEngine__default.default.find(SELECTOR_INNER_ELEM, this._parent); + } - const complete = () => this._transitionComplete(element, active, callback); + _getActiveElem() { + return this._getChildren().find(child => this._elemIsActive(child)) || null; + } - if (active && isTransitioning) { - active.classList.remove(CLASS_NAME_SHOW); + _setInitialAttributes(parent, children) { + this._setAttributeIfNotExists(parent, 'role', 'tablist'); - this._queueCallback(complete, element, true); - } else { - complete(); + for (const child of children) { + this._setInitialAttributesOnChild(child); } } - _transitionComplete(element, active, callback) { - if (active) { - active.classList.remove(CLASS_NAME_ACTIVE); - const dropdownChild = SelectorEngine__default.default.findOne(SELECTOR_DROPDOWN_ACTIVE_CHILD, active.parentNode); + _setInitialAttributesOnChild(child) { + child = this._getInnerElement(child); - if (dropdownChild) { - dropdownChild.classList.remove(CLASS_NAME_ACTIVE); - } + const isActive = this._elemIsActive(child); - if (active.getAttribute('role') === 'tab') { - active.setAttribute('aria-selected', false); - } + const outerElem = this._getOuterElement(child); + + child.setAttribute('aria-selected', isActive); + + if (outerElem !== child) { + this._setAttributeIfNotExists(outerElem, 'role', 'presentation'); } - element.classList.add(CLASS_NAME_ACTIVE); + if (!isActive) { + child.setAttribute('tabindex', '-1'); + } - if (element.getAttribute('role') === 'tab') { - element.setAttribute('aria-selected', true); + this._setAttributeIfNotExists(child, 'role', 'tab'); // set attributes to the related panel too + + + this._setInitialAttributesOnTargetPanel(child); + } + + _setInitialAttributesOnTargetPanel(child) { + const target = index.getElementFromSelector(child); + + if (!target) { + return; } - reflow(element); + this._setAttributeIfNotExists(target, 'role', 'tabpanel'); - if (element.classList.contains(CLASS_NAME_FADE)) { - element.classList.add(CLASS_NAME_SHOW); + if (child.id) { + this._setAttributeIfNotExists(target, 'aria-labelledby', `#${child.id}`); } + } - let parent = element.parentNode; + _toggleDropDown(element, open) { + const outerElem = this._getOuterElement(element); - if (parent && parent.nodeName === 'LI') { - parent = parent.parentNode; + if (!outerElem.classList.contains(CLASS_DROPDOWN)) { + return; } - if (parent && parent.classList.contains(CLASS_NAME_DROPDOWN_MENU)) { - const dropdownElement = element.closest(SELECTOR_DROPDOWN); + const toggle = (selector, className) => { + const element = SelectorEngine__default.default.findOne(selector, outerElem); - if (dropdownElement) { - SelectorEngine__default.default.find(SELECTOR_DROPDOWN_TOGGLE, dropdownElement).forEach(dropdown => dropdown.classList.add(CLASS_NAME_ACTIVE)); + if (element) { + element.classList.toggle(className, open); } + }; - element.setAttribute('aria-expanded', true); - } + toggle(SELECTOR_DROPDOWN_TOGGLE, CLASS_NAME_ACTIVE); + toggle(SELECTOR_DROPDOWN_MENU, CLASS_NAME_SHOW); + toggle(SELECTOR_DROPDOWN_ITEM, CLASS_NAME_ACTIVE); + outerElem.setAttribute('aria-expanded', open); + } - if (callback) { - callback(); + _setAttributeIfNotExists(element, attribute, value) { + if (!element.hasAttribute(attribute)) { + element.setAttribute(attribute, value); } + } + + _elemIsActive(elem) { + return elem.classList.contains(CLASS_NAME_ACTIVE); + } // Try to get the inner element (usually the .nav-link) + + + _getInnerElement(elem) { + return elem.matches(SELECTOR_INNER_ELEM) ? elem : SelectorEngine__default.default.findOne(SELECTOR_INNER_ELEM, elem); + } // Try to get the outer element (usually the .nav-item) + + + _getOuterElement(elem) { + return elem.closest(SELECTOR_OUTER) || elem; } // Static @@ -288,21 +296,21 @@ return this.each(function () { const data = Tab.getOrCreateInstance(this); - if (typeof config === 'string') { - if (typeof data[config] === 'undefined') { - throw new TypeError(`No method named "${config}"`); - } + if (typeof config !== 'string') { + return; + } - data[config](); + if (data[config] === undefined || config.startsWith('_') || config === 'constructor') { + throw new TypeError(`No method named "${config}"`); } + + data[config](); }); } } /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ + * Data API implementation */ @@ -311,21 +319,26 @@ event.preventDefault(); } - if (isDisabled(this)) { + if (index.isDisabled(this)) { return; } - const data = Tab.getOrCreateInstance(this); - data.show(); + Tab.getOrCreateInstance(this).show(); + }); + /** + * Initialize on focus + */ + + EventHandler__default.default.on(window, EVENT_LOAD_DATA_API, () => { + for (const element of SelectorEngine__default.default.find(SELECTOR_DATA_TOGGLE_ACTIVE)) { + Tab.getOrCreateInstance(element); + } }); /** - * ------------------------------------------------------------------------ * jQuery - * ------------------------------------------------------------------------ - * add .Tab to jQuery only if jQuery is present */ - defineJQueryPlugin(Tab); + index.defineJQueryPlugin(Tab); return Tab; -- cgit v1.2.3 From edf9c40956d19e6ab3f9151bfe0dfac6be06fa21 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Tue, 19 Jul 2022 18:43:58 +0300 Subject: Release v5.2.0 (#36768) * Bump version to 5.2.0 * Dist * Update masthead.html --- js/dist/tab.js | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) (limited to 'js/dist/tab.js') diff --git a/js/dist/tab.js b/js/dist/tab.js index bf7c991b4..e36ff611a 100644 --- a/js/dist/tab.js +++ b/js/dist/tab.js @@ -1,5 +1,5 @@ /*! - * Bootstrap tab.js v5.2.0-beta1 (https://getbootstrap.com/) + * Bootstrap tab.js v5.2.0 (https://getbootstrap.com/) * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ @@ -17,7 +17,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0-beta1): tab.js + * Bootstrap (v5.2.0): tab.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -118,15 +118,9 @@ this._activate(index.getElementFromSelector(element)); // Search and activate/show the proper section - const isAnimated = element.classList.contains(CLASS_NAME_FADE); - const complete = () => { - if (isAnimated) { - // todo: maybe is redundant - element.classList.add(CLASS_NAME_SHOW); - } - if (element.getAttribute('role') !== 'tab') { + element.classList.add(CLASS_NAME_SHOW); return; } @@ -141,7 +135,7 @@ }); }; - this._queueCallback(complete, element, isAnimated); + this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE)); } _deactivate(element, relatedElem) { @@ -155,15 +149,9 @@ this._deactivate(index.getElementFromSelector(element)); // Search and deactivate the shown section too - const isAnimated = element.classList.contains(CLASS_NAME_FADE); - const complete = () => { - if (isAnimated) { - // todo maybe is redundant - element.classList.remove(CLASS_NAME_SHOW); - } - if (element.getAttribute('role') !== 'tab') { + element.classList.remove(CLASS_NAME_SHOW); return; } @@ -177,7 +165,7 @@ }); }; - this._queueCallback(complete, element, isAnimated); + this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE)); } _keydown(event) { -- cgit v1.2.3 From 23e50829f958ea1d741d63e2781716be037e4644 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Wed, 7 Sep 2022 18:31:39 +0300 Subject: Release v5.2.1 (#37098) * Bump version to v5.2.1. * Dist --- js/dist/tab.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/dist/tab.js') diff --git a/js/dist/tab.js b/js/dist/tab.js index e36ff611a..c727d6c47 100644 --- a/js/dist/tab.js +++ b/js/dist/tab.js @@ -1,5 +1,5 @@ /*! - * Bootstrap tab.js v5.2.0 (https://getbootstrap.com/) + * Bootstrap tab.js v5.2.1 (https://getbootstrap.com/) * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ @@ -17,7 +17,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.0): tab.js + * Bootstrap (v5.2.1): tab.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ -- cgit v1.2.3 From 961d5ff9844372a4e294980c667bbe7e0651cdeb Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Mon, 3 Oct 2022 10:44:02 +0300 Subject: Release v5.2.2 (#37236) * Bump version to v5.2.2 * Dist --- js/dist/tab.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'js/dist/tab.js') diff --git a/js/dist/tab.js b/js/dist/tab.js index c727d6c47..c11e68d37 100644 --- a/js/dist/tab.js +++ b/js/dist/tab.js @@ -1,5 +1,5 @@ /*! - * Bootstrap tab.js v5.2.1 (https://getbootstrap.com/) + * Bootstrap tab.js v5.2.2 (https://getbootstrap.com/) * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ @@ -17,7 +17,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.1): tab.js + * Bootstrap (v5.2.2): tab.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -45,7 +45,6 @@ const CLASS_DROPDOWN = 'dropdown'; const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'; const SELECTOR_DROPDOWN_MENU = '.dropdown-menu'; - const SELECTOR_DROPDOWN_ITEM = '.dropdown-item'; const NOT_SELECTOR_DROPDOWN_TOGGLE = ':not(.dropdown-toggle)'; const SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]'; const SELECTOR_OUTER = '.nav-item, .list-group-item'; @@ -124,7 +123,6 @@ return; } - element.focus(); element.removeAttribute('tabindex'); element.setAttribute('aria-selected', true); @@ -180,6 +178,9 @@ const nextActiveElement = index.getNextActiveElement(this._getChildren().filter(element => !index.isDisabled(element)), event.target, isNext, true); if (nextActiveElement) { + nextActiveElement.focus({ + preventScroll: true + }); Tab.getOrCreateInstance(nextActiveElement).show(); } } @@ -255,7 +256,6 @@ toggle(SELECTOR_DROPDOWN_TOGGLE, CLASS_NAME_ACTIVE); toggle(SELECTOR_DROPDOWN_MENU, CLASS_NAME_SHOW); - toggle(SELECTOR_DROPDOWN_ITEM, CLASS_NAME_ACTIVE); outerElem.setAttribute('aria-expanded', open); } -- cgit v1.2.3 From cb021439c683d9805e2864c58095b92d405e9b11 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Mon, 21 Nov 2022 20:19:01 +0200 Subject: Dist --- js/dist/tab.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/dist/tab.js') diff --git a/js/dist/tab.js b/js/dist/tab.js index c11e68d37..89de18a0b 100644 --- a/js/dist/tab.js +++ b/js/dist/tab.js @@ -1,5 +1,5 @@ /*! - * Bootstrap tab.js v5.2.2 (https://getbootstrap.com/) + * Bootstrap tab.js v5.2.3 (https://getbootstrap.com/) * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ @@ -17,7 +17,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.2): tab.js + * Bootstrap (v5.2.3): tab.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ -- cgit v1.2.3 From cf9454caa00872899215603e5e036d9a824b1b11 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Sat, 24 Dec 2022 18:37:22 +0200 Subject: Release v5.3.0-alpha1 (#37661) * Bump version to 5.3.0-alpha1 * Dist * Add docs versions updates * Update note in homepage hero Co-authored-by: Mark Otto --- js/dist/tab.js | 150 ++++++++++++++++++--------------------------------------- 1 file changed, 46 insertions(+), 104 deletions(-) (limited to 'js/dist/tab.js') diff --git a/js/dist/tab.js b/js/dist/tab.js index 89de18a0b..6fd8deab6 100644 --- a/js/dist/tab.js +++ b/js/dist/tab.js @@ -1,26 +1,21 @@ /*! - * Bootstrap tab.js v5.2.3 (https://getbootstrap.com/) + * Bootstrap tab.js v5.3.0-alpha1 (https://getbootstrap.com/) * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./util/index'), require('./dom/event-handler'), require('./dom/selector-engine'), require('./base-component')) : + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./util/index.js'), require('./dom/event-handler.js'), require('./dom/selector-engine.js'), require('./base-component.js')) : typeof define === 'function' && define.amd ? define(['./util/index', './dom/event-handler', './dom/selector-engine', './base-component'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tab = factory(global.Index, global.EventHandler, global.SelectorEngine, global.BaseComponent)); -})(this, (function (index, EventHandler, SelectorEngine, BaseComponent) { 'use strict'; - - const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e }; - - const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler); - const SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine); - const BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent); +})(this, (function (index_js, EventHandler, SelectorEngine, BaseComponent) { 'use strict'; /** * -------------------------------------------------------------------------- - * Bootstrap (v5.2.3): tab.js + * Bootstrap (v5.3.0-alpha1): tab.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ + /** * Constants */ @@ -50,133 +45,108 @@ const SELECTOR_OUTER = '.nav-item, .list-group-item'; const SELECTOR_INNER = `.nav-link${NOT_SELECTOR_DROPDOWN_TOGGLE}, .list-group-item${NOT_SELECTOR_DROPDOWN_TOGGLE}, [role="tab"]${NOT_SELECTOR_DROPDOWN_TOGGLE}`; const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]'; // todo:v6: could be only `tab` - const SELECTOR_INNER_ELEM = `${SELECTOR_INNER}, ${SELECTOR_DATA_TOGGLE}`; const SELECTOR_DATA_TOGGLE_ACTIVE = `.${CLASS_NAME_ACTIVE}[data-bs-toggle="tab"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="pill"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="list"]`; + /** * Class definition */ - class Tab extends BaseComponent__default.default { + class Tab extends BaseComponent { constructor(element) { super(element); this._parent = this._element.closest(SELECTOR_TAB_PANEL); - if (!this._parent) { - return; // todo: should Throw exception on v6 + return; + // todo: should Throw exception on v6 // throw new TypeError(`${element.outerHTML} has not a valid parent ${SELECTOR_INNER_ELEM}`) - } // Set up initial aria attributes - + } + // Set up initial aria attributes this._setInitialAttributes(this._parent, this._getChildren()); + EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event)); + } - EventHandler__default.default.on(this._element, EVENT_KEYDOWN, event => this._keydown(event)); - } // Getters - - + // Getters static get NAME() { return NAME; - } // Public - + } + // Public show() { // Shows this elem and deactivate the active sibling if exists const innerElem = this._element; - if (this._elemIsActive(innerElem)) { return; - } // Search for active tab on same parent to deactivate it - + } + // Search for active tab on same parent to deactivate it const active = this._getActiveElem(); - - const hideEvent = active ? EventHandler__default.default.trigger(active, EVENT_HIDE, { + const hideEvent = active ? EventHandler.trigger(active, EVENT_HIDE, { relatedTarget: innerElem }) : null; - const showEvent = EventHandler__default.default.trigger(innerElem, EVENT_SHOW, { + const showEvent = EventHandler.trigger(innerElem, EVENT_SHOW, { relatedTarget: active }); - if (showEvent.defaultPrevented || hideEvent && hideEvent.defaultPrevented) { return; } - this._deactivate(active, innerElem); - this._activate(innerElem, active); - } // Private - + } + // Private _activate(element, relatedElem) { if (!element) { return; } - element.classList.add(CLASS_NAME_ACTIVE); - - this._activate(index.getElementFromSelector(element)); // Search and activate/show the proper section - + this._activate(SelectorEngine.getElementFromSelector(element)); // Search and activate/show the proper section const complete = () => { if (element.getAttribute('role') !== 'tab') { element.classList.add(CLASS_NAME_SHOW); return; } - element.removeAttribute('tabindex'); element.setAttribute('aria-selected', true); - this._toggleDropDown(element, true); - - EventHandler__default.default.trigger(element, EVENT_SHOWN, { + EventHandler.trigger(element, EVENT_SHOWN, { relatedTarget: relatedElem }); }; - this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE)); } - _deactivate(element, relatedElem) { if (!element) { return; } - element.classList.remove(CLASS_NAME_ACTIVE); element.blur(); - - this._deactivate(index.getElementFromSelector(element)); // Search and deactivate the shown section too - + this._deactivate(SelectorEngine.getElementFromSelector(element)); // Search and deactivate the shown section too const complete = () => { if (element.getAttribute('role') !== 'tab') { element.classList.remove(CLASS_NAME_SHOW); return; } - element.setAttribute('aria-selected', false); element.setAttribute('tabindex', '-1'); - this._toggleDropDown(element, false); - - EventHandler__default.default.trigger(element, EVENT_HIDDEN, { + EventHandler.trigger(element, EVENT_HIDDEN, { relatedTarget: relatedElem }); }; - this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE)); } - _keydown(event) { if (![ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY].includes(event.key)) { return; } - event.stopPropagation(); // stopPropagation/preventDefault both added to support up/down keys without scrolling the page - event.preventDefault(); const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key); - const nextActiveElement = index.getNextActiveElement(this._getChildren().filter(element => !index.isDisabled(element)), event.target, isNext, true); - + const nextActiveElement = index_js.getNextActiveElement(this._getChildren().filter(element => !index_js.isDisabled(element)), event.target, isNext, true); if (nextActiveElement) { nextActiveElement.focus({ preventScroll: true @@ -184,141 +154,113 @@ Tab.getOrCreateInstance(nextActiveElement).show(); } } - _getChildren() { // collection of inner elements - return SelectorEngine__default.default.find(SELECTOR_INNER_ELEM, this._parent); + return SelectorEngine.find(SELECTOR_INNER_ELEM, this._parent); } - _getActiveElem() { return this._getChildren().find(child => this._elemIsActive(child)) || null; } - _setInitialAttributes(parent, children) { this._setAttributeIfNotExists(parent, 'role', 'tablist'); - for (const child of children) { this._setInitialAttributesOnChild(child); } } - _setInitialAttributesOnChild(child) { child = this._getInnerElement(child); - const isActive = this._elemIsActive(child); - const outerElem = this._getOuterElement(child); - child.setAttribute('aria-selected', isActive); - if (outerElem !== child) { this._setAttributeIfNotExists(outerElem, 'role', 'presentation'); } - if (!isActive) { child.setAttribute('tabindex', '-1'); } + this._setAttributeIfNotExists(child, 'role', 'tab'); - this._setAttributeIfNotExists(child, 'role', 'tab'); // set attributes to the related panel too - - + // set attributes to the related panel too this._setInitialAttributesOnTargetPanel(child); } - _setInitialAttributesOnTargetPanel(child) { - const target = index.getElementFromSelector(child); - + const target = SelectorEngine.getElementFromSelector(child); if (!target) { return; } - this._setAttributeIfNotExists(target, 'role', 'tabpanel'); - if (child.id) { this._setAttributeIfNotExists(target, 'aria-labelledby', `#${child.id}`); } } - _toggleDropDown(element, open) { const outerElem = this._getOuterElement(element); - if (!outerElem.classList.contains(CLASS_DROPDOWN)) { return; } - const toggle = (selector, className) => { - const element = SelectorEngine__default.default.findOne(selector, outerElem); - + const element = SelectorEngine.findOne(selector, outerElem); if (element) { element.classList.toggle(className, open); } }; - toggle(SELECTOR_DROPDOWN_TOGGLE, CLASS_NAME_ACTIVE); toggle(SELECTOR_DROPDOWN_MENU, CLASS_NAME_SHOW); outerElem.setAttribute('aria-expanded', open); } - _setAttributeIfNotExists(element, attribute, value) { if (!element.hasAttribute(attribute)) { element.setAttribute(attribute, value); } } - _elemIsActive(elem) { return elem.classList.contains(CLASS_NAME_ACTIVE); - } // Try to get the inner element (usually the .nav-link) - + } + // Try to get the inner element (usually the .nav-link) _getInnerElement(elem) { - return elem.matches(SELECTOR_INNER_ELEM) ? elem : SelectorEngine__default.default.findOne(SELECTOR_INNER_ELEM, elem); - } // Try to get the outer element (usually the .nav-item) - + return elem.matches(SELECTOR_INNER_ELEM) ? elem : SelectorEngine.findOne(SELECTOR_INNER_ELEM, elem); + } + // Try to get the outer element (usually the .nav-item) _getOuterElement(elem) { return elem.closest(SELECTOR_OUTER) || elem; - } // Static - + } + // Static static jQueryInterface(config) { return this.each(function () { const data = Tab.getOrCreateInstance(this); - if (typeof config !== 'string') { return; } - if (data[config] === undefined || config.startsWith('_') || config === 'constructor') { throw new TypeError(`No method named "${config}"`); } - data[config](); }); } - } + /** * Data API implementation */ - - EventHandler__default.default.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { + EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { if (['A', 'AREA'].includes(this.tagName)) { event.preventDefault(); } - - if (index.isDisabled(this)) { + if (index_js.isDisabled(this)) { return; } - Tab.getOrCreateInstance(this).show(); }); + /** * Initialize on focus */ - - EventHandler__default.default.on(window, EVENT_LOAD_DATA_API, () => { - for (const element of SelectorEngine__default.default.find(SELECTOR_DATA_TOGGLE_ACTIVE)) { + EventHandler.on(window, EVENT_LOAD_DATA_API, () => { + for (const element of SelectorEngine.find(SELECTOR_DATA_TOGGLE_ACTIVE)) { Tab.getOrCreateInstance(element); } }); @@ -326,7 +268,7 @@ * jQuery */ - index.defineJQueryPlugin(Tab); + index_js.defineJQueryPlugin(Tab); return Tab; -- cgit v1.2.3 From c877cefcef18d6a60c5eaec8df469933e64e212a Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Fri, 24 Mar 2023 16:30:16 +0200 Subject: Release v5.3.0-alpha2 (#38244) * Bump version to 5.3.0-alpha2 * Dist --- js/dist/tab.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'js/dist/tab.js') diff --git a/js/dist/tab.js b/js/dist/tab.js index 6fd8deab6..f6779a5f1 100644 --- a/js/dist/tab.js +++ b/js/dist/tab.js @@ -1,6 +1,6 @@ /*! - * Bootstrap tab.js v5.3.0-alpha1 (https://getbootstrap.com/) - * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) + * Bootstrap tab.js v5.3.0-alpha2 (https://getbootstrap.com/) + * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ (function (global, factory) { @@ -11,7 +11,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.3.0-alpha1): tab.js + * Bootstrap tab.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -190,7 +190,7 @@ } this._setAttributeIfNotExists(target, 'role', 'tabpanel'); if (child.id) { - this._setAttributeIfNotExists(target, 'aria-labelledby', `#${child.id}`); + this._setAttributeIfNotExists(target, 'aria-labelledby', `${child.id}`); } } _toggleDropDown(element, open) { -- cgit v1.2.3 From ac576614a5515e429f27e756fad81d5aa05e95a6 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Mon, 3 Apr 2023 10:26:50 +0300 Subject: Release v5.3.0-alpha3 (#38357) * Bump version to 5.3.0-alpha3 * Dist --- js/dist/tab.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'js/dist/tab.js') diff --git a/js/dist/tab.js b/js/dist/tab.js index f6779a5f1..e0283620a 100644 --- a/js/dist/tab.js +++ b/js/dist/tab.js @@ -1,13 +1,13 @@ /*! - * Bootstrap tab.js v5.3.0-alpha2 (https://getbootstrap.com/) + * Bootstrap tab.js v5.3.0-alpha3 (https://getbootstrap.com/) * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./util/index.js'), require('./dom/event-handler.js'), require('./dom/selector-engine.js'), require('./base-component.js')) : - typeof define === 'function' && define.amd ? define(['./util/index', './dom/event-handler', './dom/selector-engine', './base-component'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tab = factory(global.Index, global.EventHandler, global.SelectorEngine, global.BaseComponent)); -})(this, (function (index_js, EventHandler, SelectorEngine, BaseComponent) { 'use strict'; + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./base-component.js'), require('./dom/event-handler.js'), require('./dom/selector-engine.js'), require('./util/index.js')) : + typeof define === 'function' && define.amd ? define(['./base-component', './dom/event-handler', './dom/selector-engine', './util/index'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tab = factory(global.BaseComponent, global.EventHandler, global.SelectorEngine, global.Index)); +})(this, (function (BaseComponent, EventHandler, SelectorEngine, index_js) { 'use strict'; /** * -------------------------------------------------------------------------- @@ -44,7 +44,7 @@ const SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]'; const SELECTOR_OUTER = '.nav-item, .list-group-item'; const SELECTOR_INNER = `.nav-link${NOT_SELECTOR_DROPDOWN_TOGGLE}, .list-group-item${NOT_SELECTOR_DROPDOWN_TOGGLE}, [role="tab"]${NOT_SELECTOR_DROPDOWN_TOGGLE}`; - const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]'; // todo:v6: could be only `tab` + const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]'; // TODO: could only be `tab` in v6 const SELECTOR_INNER_ELEM = `${SELECTOR_INNER}, ${SELECTOR_DATA_TOGGLE}`; const SELECTOR_DATA_TOGGLE_ACTIVE = `.${CLASS_NAME_ACTIVE}[data-bs-toggle="tab"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="pill"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="list"]`; @@ -58,7 +58,7 @@ this._parent = this._element.closest(SELECTOR_TAB_PANEL); if (!this._parent) { return; - // todo: should Throw exception on v6 + // TODO: should throw exception in v6 // throw new TypeError(`${element.outerHTML} has not a valid parent ${SELECTOR_INNER_ELEM}`) } -- cgit v1.2.3 From 60098ac499d30aa50575b0b7137391c06ef25429 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Tue, 30 May 2023 18:15:55 +0300 Subject: Release v5.3.0 (#38657) * Bump version to 5.3.0 * Dist --- js/dist/tab.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'js/dist/tab.js') diff --git a/js/dist/tab.js b/js/dist/tab.js index e0283620a..38c34d3fd 100644 --- a/js/dist/tab.js +++ b/js/dist/tab.js @@ -1,5 +1,5 @@ /*! - * Bootstrap tab.js v5.3.0-alpha3 (https://getbootstrap.com/) + * Bootstrap tab.js v5.3.0 (https://getbootstrap.com/) * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ @@ -16,6 +16,7 @@ * -------------------------------------------------------------------------- */ + /** * Constants */ -- cgit v1.2.3 From 2a1bf52b73fc9a97f6fef75aa1b29b3e9f0288b3 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Wed, 26 Jul 2023 10:46:38 +0300 Subject: Release v5.3.1 (#38956) * Bump version to 5.3.1 * Dist --- js/dist/tab.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'js/dist/tab.js') diff --git a/js/dist/tab.js b/js/dist/tab.js index 38c34d3fd..79e6664b5 100644 --- a/js/dist/tab.js +++ b/js/dist/tab.js @@ -1,5 +1,5 @@ /*! - * Bootstrap tab.js v5.3.0 (https://getbootstrap.com/) + * Bootstrap tab.js v5.3.1 (https://getbootstrap.com/) * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ @@ -35,6 +35,8 @@ const ARROW_RIGHT_KEY = 'ArrowRight'; const ARROW_UP_KEY = 'ArrowUp'; const ARROW_DOWN_KEY = 'ArrowDown'; + const HOME_KEY = 'Home'; + const END_KEY = 'End'; const CLASS_NAME_ACTIVE = 'active'; const CLASS_NAME_FADE = 'fade'; const CLASS_NAME_SHOW = 'show'; @@ -141,13 +143,19 @@ this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE)); } _keydown(event) { - if (![ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY].includes(event.key)) { + if (![ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY, HOME_KEY, END_KEY].includes(event.key)) { return; } event.stopPropagation(); // stopPropagation/preventDefault both added to support up/down keys without scrolling the page event.preventDefault(); - const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key); - const nextActiveElement = index_js.getNextActiveElement(this._getChildren().filter(element => !index_js.isDisabled(element)), event.target, isNext, true); + const children = this._getChildren().filter(element => !index_js.isDisabled(element)); + let nextActiveElement; + if ([HOME_KEY, END_KEY].includes(event.key)) { + nextActiveElement = children[event.key === HOME_KEY ? 0 : children.length - 1]; + } else { + const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key); + nextActiveElement = index_js.getNextActiveElement(children, event.target, isNext, true); + } if (nextActiveElement) { nextActiveElement.focus({ preventScroll: true -- cgit v1.2.3 From 344e912d04b5b6a04482113eff20ab416ff01048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20D=C3=A9ramond?= Date: Thu, 14 Sep 2023 16:19:27 +0200 Subject: Release v5.3.2 (#39173) * Bump version to 5.3.2 * Dist --- js/dist/tab.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/dist/tab.js') diff --git a/js/dist/tab.js b/js/dist/tab.js index 79e6664b5..44579b44f 100644 --- a/js/dist/tab.js +++ b/js/dist/tab.js @@ -1,5 +1,5 @@ /*! - * Bootstrap tab.js v5.3.1 (https://getbootstrap.com/) + * Bootstrap tab.js v5.3.2 (https://getbootstrap.com/) * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ @@ -43,7 +43,7 @@ const CLASS_DROPDOWN = 'dropdown'; const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'; const SELECTOR_DROPDOWN_MENU = '.dropdown-menu'; - const NOT_SELECTOR_DROPDOWN_TOGGLE = ':not(.dropdown-toggle)'; + const NOT_SELECTOR_DROPDOWN_TOGGLE = `:not(${SELECTOR_DROPDOWN_TOGGLE})`; const SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]'; const SELECTOR_OUTER = '.nav-item, .list-group-item'; const SELECTOR_INNER = `.nav-link${NOT_SELECTOR_DROPDOWN_TOGGLE}, .list-group-item${NOT_SELECTOR_DROPDOWN_TOGGLE}, [role="tab"]${NOT_SELECTOR_DROPDOWN_TOGGLE}`; -- cgit v1.2.3 From 6e1f75f420f68e1d52733b8e407fc7c3766c9dba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20D=C3=A9ramond?= Date: Tue, 20 Feb 2024 16:14:29 +0100 Subject: Release v5.3.3 (#39524) * Release v5.3.3 * Dist --------- Co-authored-by: XhmikosR --- js/dist/tab.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/dist/tab.js') diff --git a/js/dist/tab.js b/js/dist/tab.js index 44579b44f..a4ad95a10 100644 --- a/js/dist/tab.js +++ b/js/dist/tab.js @@ -1,6 +1,6 @@ /*! - * Bootstrap tab.js v5.3.2 (https://getbootstrap.com/) - * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) + * Bootstrap tab.js v5.3.3 (https://getbootstrap.com/) + * Copyright 2011-2024 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ (function (global, factory) { -- cgit v1.2.3