mirror of
https://github.com/twbs/bootstrap.git
synced 2025-10-03 00:03:44 -04:00
Compare commits
4 Commits
4e60f8ebbe
...
5e628e87b0
Author | SHA1 | Date | |
---|---|---|---|
|
5e628e87b0 | ||
|
fbbccac00e | ||
|
f32ec6d1eb | ||
|
86e9c1142f |
15
js/dist/collapse.js
vendored
15
js/dist/collapse.js
vendored
@ -99,8 +99,6 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let activeChildren = [];
|
let activeChildren = [];
|
||||||
|
|
||||||
// find active children
|
|
||||||
if (this._config.parent) {
|
if (this._config.parent) {
|
||||||
activeChildren = this._getFirstLevelChildren(SELECTOR_ACTIVES).filter(element => element !== this._element).map(element => Collapse.getOrCreateInstance(element, {
|
activeChildren = this._getFirstLevelChildren(SELECTOR_ACTIVES).filter(element => element !== this._element).map(element => Collapse.getOrCreateInstance(element, {
|
||||||
toggle: false
|
toggle: false
|
||||||
@ -122,11 +120,24 @@
|
|||||||
this._element.style[dimension] = 0;
|
this._element.style[dimension] = 0;
|
||||||
this._addAriaAndCollapsedClass(this._triggerArray, true);
|
this._addAriaAndCollapsedClass(this._triggerArray, true);
|
||||||
this._isTransitioning = true;
|
this._isTransitioning = true;
|
||||||
|
|
||||||
|
// 🔧 Firefox scroll jump fix
|
||||||
|
const isFirefox = navigator.userAgent.toLowerCase().includes('firefox');
|
||||||
|
let originalScrollMarginTop = '';
|
||||||
|
if (isFirefox) {
|
||||||
|
originalScrollMarginTop = this._element.style.scrollMarginTop;
|
||||||
|
this._element.style.scrollMarginTop = '0px';
|
||||||
|
}
|
||||||
const complete = () => {
|
const complete = () => {
|
||||||
this._isTransitioning = false;
|
this._isTransitioning = false;
|
||||||
this._element.classList.remove(CLASS_NAME_COLLAPSING);
|
this._element.classList.remove(CLASS_NAME_COLLAPSING);
|
||||||
this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
|
this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
|
||||||
this._element.style[dimension] = '';
|
this._element.style[dimension] = '';
|
||||||
|
|
||||||
|
// ✅ Restore original scroll-margin-top
|
||||||
|
if (isFirefox) {
|
||||||
|
this._element.style.scrollMarginTop = originalScrollMarginTop;
|
||||||
|
}
|
||||||
EventHandler.trigger(this._element, EVENT_SHOWN);
|
EventHandler.trigger(this._element, EVENT_SHOWN);
|
||||||
};
|
};
|
||||||
const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
|
const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
|
||||||
|
@ -115,7 +115,6 @@ class Collapse extends BaseComponent {
|
|||||||
|
|
||||||
let activeChildren = []
|
let activeChildren = []
|
||||||
|
|
||||||
// find active children
|
|
||||||
if (this._config.parent) {
|
if (this._config.parent) {
|
||||||
activeChildren = this._getFirstLevelChildren(SELECTOR_ACTIVES)
|
activeChildren = this._getFirstLevelChildren(SELECTOR_ACTIVES)
|
||||||
.filter(element => element !== this._element)
|
.filter(element => element !== this._element)
|
||||||
@ -145,6 +144,15 @@ class Collapse extends BaseComponent {
|
|||||||
this._addAriaAndCollapsedClass(this._triggerArray, true)
|
this._addAriaAndCollapsedClass(this._triggerArray, true)
|
||||||
this._isTransitioning = true
|
this._isTransitioning = true
|
||||||
|
|
||||||
|
// 🔧 Firefox scroll jump fix
|
||||||
|
const isFirefox = navigator.userAgent.toLowerCase().includes('firefox')
|
||||||
|
let originalScrollMarginTop = ''
|
||||||
|
|
||||||
|
if (isFirefox) {
|
||||||
|
originalScrollMarginTop = this._element.style.scrollMarginTop
|
||||||
|
this._element.style.scrollMarginTop = '0px'
|
||||||
|
}
|
||||||
|
|
||||||
const complete = () => {
|
const complete = () => {
|
||||||
this._isTransitioning = false
|
this._isTransitioning = false
|
||||||
|
|
||||||
@ -153,6 +161,11 @@ class Collapse extends BaseComponent {
|
|||||||
|
|
||||||
this._element.style[dimension] = ''
|
this._element.style[dimension] = ''
|
||||||
|
|
||||||
|
// ✅ Restore original scroll-margin-top
|
||||||
|
if (isFirefox) {
|
||||||
|
this._element.style.scrollMarginTop = originalScrollMarginTop
|
||||||
|
}
|
||||||
|
|
||||||
EventHandler.trigger(this._element, EVENT_SHOWN)
|
EventHandler.trigger(this._element, EVENT_SHOWN)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user