From: Patrick H. Lauke Date: Tue, 24 May 2022 18:16:58 +0000 (+0100) Subject: Dynamic tabs: use buttons rather than links (backport to v4) (#33163) X-Git-Tag: v4.6.2~16 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=7d57d9a68bbc2bc703fbf2c66fd2ad2546d67557;p=thirdparty%2Fbootstrap.git Dynamic tabs: use buttons rather than links (backport to v4) (#33163) * Manually backport 32630 Dynamic tabs: use buttons rather than links * Tweak unit test * Tweak unit tests * More tweakage * show() should also bail if `disabled` attribute is set * Tweak tests * Simplify test for relatedTarget * Temporarily remove problematic test (as i can't get local tests to run just noww) * Revert previous * test: fix broken test cases for tab.js * test: fix role=tablist invalid on nav element * test: prefer
over
* Manually backport 32630 Dynamic tabs: use buttons rather than links * test: fix broken test cases for tab.js * Fixes * Remove and ignore lock file Co-authored-by: alpadev Co-authored-by: Mark Otto Co-authored-by: Mark Otto --- diff --git a/.gitignore b/.gitignore index 6b72413587..2215d636ad 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ # Ignore docs files /_site/ -# Hugo folders +# Hugo files /resources/ +/.hugo_build.lock # Numerous always-ignore extensions *.diff diff --git a/js/src/tab.js b/js/src/tab.js index 85f2f2ebc1..9c2e22d088 100644 --- a/js/src/tab.js +++ b/js/src/tab.js @@ -58,7 +58,8 @@ class Tab { if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(CLASS_NAME_ACTIVE) || - $(this._element).hasClass(CLASS_NAME_DISABLED)) { + $(this._element).hasClass(CLASS_NAME_DISABLED) || + this._element.hasAttribute('disabled')) { return } diff --git a/js/tests/unit/tab.js b/js/tests/unit/tab.js index 9ede231c5b..8f80a00c84 100644 --- a/js/tests/unit/tab.js +++ b/js/tests/unit/tab.js @@ -44,14 +44,30 @@ $(function () { assert.strictEqual($tab[0], $el[0], 'collection contains element') }) - QUnit.test('should activate element by tab id', function (assert) { + QUnit.test('should activate element by tab id (using buttons, the preferred semantic way)', function (assert) { assert.expect(2) - var tabsHTML = '