From 35f80bb12e4e71fd777ee60ffa43711d8f84b1a6 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Thu, 10 Aug 2017 20:56:35 -0700 Subject: bump to beta --- js/src/tab.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/src/tab.js') diff --git a/js/src/tab.js b/js/src/tab.js index c7bc520df..1613bbb7d 100644 --- a/js/src/tab.js +++ b/js/src/tab.js @@ -3,7 +3,7 @@ import Util from './util' /** * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-alpha.6): tab.js + * Bootstrap (v4.0.0-beta): tab.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ @@ -18,7 +18,7 @@ const Tab = (($) => { */ const NAME = 'tab' - const VERSION = '4.0.0-alpha.6' + const VERSION = '4.0.0-beta' const DATA_KEY = 'bs.tab' const EVENT_KEY = `.${DATA_KEY}` const DATA_API_KEY = '.data-api' -- cgit v1.2.3 From b55fa5579b409be76f551cbb3c1e46e1ad71bdfd Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Fri, 14 Jul 2017 17:49:30 +0300 Subject: tabs: make the `active` selector more restrictive again. When one uses say a carousel inside a tab, the `.active` selector previously matches the carousel ones too leading to broken tabs. It's not the perfect solution but should the job for now. --- js/src/tab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/src/tab.js') diff --git a/js/src/tab.js b/js/src/tab.js index 1613bbb7d..4fd69c507 100644 --- a/js/src/tab.js +++ b/js/src/tab.js @@ -44,7 +44,7 @@ const Tab = (($) => { const Selector = { DROPDOWN : '.dropdown', NAV_LIST_GROUP : '.nav, .list-group', - ACTIVE : '.active', + ACTIVE : '> .nav-item > .active, > .active', DATA_TOGGLE : '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]', DROPDOWN_TOGGLE : '.dropdown-toggle', DROPDOWN_ACTIVE_CHILD : '> .dropdown-menu .active' -- cgit v1.2.3 From 640c13062ce80b0b94aef9444050d4d3820fb2d8 Mon Sep 17 00:00:00 2001 From: Johann-S Date: Sun, 16 Jul 2017 16:04:37 +0200 Subject: When we show our tabs element use children to be more restrictive --- js/src/tab.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'js/src/tab.js') diff --git a/js/src/tab.js b/js/src/tab.js index 4fd69c507..5e5a83118 100644 --- a/js/src/tab.js +++ b/js/src/tab.js @@ -44,7 +44,7 @@ const Tab = (($) => { const Selector = { DROPDOWN : '.dropdown', NAV_LIST_GROUP : '.nav, .list-group', - ACTIVE : '> .nav-item > .active, > .active', + ACTIVE : '.active', DATA_TOGGLE : '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]', DROPDOWN_TOGGLE : '.dropdown-toggle', DROPDOWN_ACTIVE_CHILD : '> .dropdown-menu .active' @@ -148,7 +148,8 @@ const Tab = (($) => { // private _activate(element, container, callback) { - const active = $(container).find(Selector.ACTIVE)[0] + const activeElements = callback ? $(container).children(Selector.ACTIVE) : $(container).find(Selector.ACTIVE) + const active = activeElements[0] const isTransitioning = callback && Util.supportsTransitionEnd() && (active && $(active).hasClass(ClassName.FADE)) -- cgit v1.2.3 From 2eb1e687bd74d147145000b3971821cc890d7652 Mon Sep 17 00:00:00 2001 From: Johann-S Date: Tue, 18 Jul 2017 14:22:39 +0200 Subject: Improve previous selector for nested tabs --- js/src/tab.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'js/src/tab.js') diff --git a/js/src/tab.js b/js/src/tab.js index 5e5a83118..4c3091495 100644 --- a/js/src/tab.js +++ b/js/src/tab.js @@ -45,6 +45,7 @@ const Tab = (($) => { DROPDOWN : '.dropdown', NAV_LIST_GROUP : '.nav, .list-group', ACTIVE : '.active', + ACTIVE_UL : '> li > .active', DATA_TOGGLE : '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]', DROPDOWN_TOGGLE : '.dropdown-toggle', DROPDOWN_ACTIVE_CHILD : '> .dropdown-menu .active' @@ -87,7 +88,8 @@ const Tab = (($) => { const selector = Util.getSelectorFromElement(this._element) if (listElement) { - previous = $.makeArray($(listElement).find(Selector.ACTIVE)) + const itemSelector = listElement.nodeName === 'UL' ? Selector.ACTIVE_UL : Selector.ACTIVE + previous = $.makeArray($(listElement).find(itemSelector)) previous = previous[previous.length - 1] } @@ -148,7 +150,13 @@ const Tab = (($) => { // private _activate(element, container, callback) { - const activeElements = callback ? $(container).children(Selector.ACTIVE) : $(container).find(Selector.ACTIVE) + let activeElements + if (container.nodeName === 'UL') { + activeElements = $(container).find(Selector.ACTIVE_UL) + } else { + activeElements = $(container).children(Selector.ACTIVE) + } + const active = activeElements[0] const isTransitioning = callback && Util.supportsTransitionEnd() -- cgit v1.2.3 From ef8c77d8dcebd13559a141e419d003c2d10cc5f3 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Thu, 27 Jul 2017 13:39:55 +0300 Subject: Tweak ESLint rules. --- js/src/tab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/src/tab.js') diff --git a/js/src/tab.js b/js/src/tab.js index 4c3091495..c32cd3776 100644 --- a/js/src/tab.js +++ b/js/src/tab.js @@ -238,7 +238,7 @@ const Tab = (($) => { } if (typeof config === 'string') { - if (data[config] === undefined) { + if (typeof data[config] === 'undefined') { throw new Error(`No method named "${config}"`) } data[config]() -- cgit v1.2.3 From 9936bf59444c402b653f28449529eab83794e911 Mon Sep 17 00:00:00 2001 From: Johann-S Date: Tue, 29 Aug 2017 21:16:00 +0200 Subject: Create a bundled release of Bootstrap with Popper.js inside --- js/src/tab.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'js/src/tab.js') diff --git a/js/src/tab.js b/js/src/tab.js index c32cd3776..18af4e7e2 100644 --- a/js/src/tab.js +++ b/js/src/tab.js @@ -1,3 +1,4 @@ +import $ from 'jquery' import Util from './util' @@ -8,7 +9,7 @@ import Util from './util' * -------------------------------------------------------------------------- */ -const Tab = (($) => { +const Tab = (() => { /** -- cgit v1.2.3 From fd56ea370c371345cd9a34e65a615853ad882577 Mon Sep 17 00:00:00 2001 From: "Patrick H. Lauke" Date: Sun, 24 Sep 2017 12:00:54 +0200 Subject: Accessibility fixes to dynamic tabs (`aria-selected`, remove dynamic tabs with dropdowns) * Use `aria-selected` instead of `aria-expanded` * Change tab.js to use `aria-selected` rather than `aria-expanded` * Add `aria-orientation=vertical` to vertical tab list * Remove dynamic tabs with dropdowns * Fix non-interactive code examples * Only set `aria-selected` on the `role="tab"` trigger - this stops `aria-selected` being incorrectly added to the `role="tabpanel"` itself (probably harmless, but nonetheless incorrect) --- js/src/tab.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'js/src/tab.js') diff --git a/js/src/tab.js b/js/src/tab.js index 18af4e7e2..2a554c287 100644 --- a/js/src/tab.js +++ b/js/src/tab.js @@ -196,11 +196,15 @@ const Tab = (() => { $(dropdownChild).removeClass(ClassName.ACTIVE) } - active.setAttribute('aria-expanded', false) + if (active.getAttribute('role') === 'tab') { + active.setAttribute('aria-selected', false) + } } $(element).addClass(ClassName.ACTIVE) - element.setAttribute('aria-expanded', true) + if (element.getAttribute('role') === 'tab') { + element.setAttribute('aria-selected', true) + } if (isTransitioning) { Util.reflow(element) -- cgit v1.2.3 From b29b1e155880ac953899889c9cbb67f7f7df0529 Mon Sep 17 00:00:00 2001 From: Johann-S Date: Tue, 3 Oct 2017 14:27:36 +0200 Subject: Use imported jQuery object --- js/src/tab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/src/tab.js') diff --git a/js/src/tab.js b/js/src/tab.js index 2a554c287..17699dfbe 100644 --- a/js/src/tab.js +++ b/js/src/tab.js @@ -282,6 +282,6 @@ const Tab = (() => { return Tab -})(jQuery) +})($) export default Tab -- cgit v1.2.3