@@ -13,13 +13,22 @@ import { placements } from '../util/popper'
13
13
import { SHOW_EVENT_MAP , HIDE_EVENT_MAP } from '../util/events'
14
14
import { removeFromArray } from '../util/lang'
15
15
import { nextFrame } from '../util/frame'
16
- import { getDefaultConfig } from '../config'
16
+ import { getDefaultConfig , getAllParentThemes } from '../config'
17
17
18
18
export type ComputePositionConfig = Parameters < typeof computePosition > [ 2 ]
19
19
20
20
const shownPoppers = [ ]
21
21
let hidingPopper = null
22
22
23
+ const shownPoppersByTheme : Record < string , any [ ] > = { }
24
+ function getShownPoppersByTheme ( theme : string ) {
25
+ let list = shownPoppersByTheme [ theme ]
26
+ if ( ! list ) {
27
+ list = shownPoppersByTheme [ theme ] = [ ]
28
+ }
29
+ return list
30
+ }
31
+
23
32
let Element : any = function ( ) { }
24
33
if ( typeof window !== 'undefined' ) {
25
34
Element = window . Element
@@ -729,6 +738,11 @@ export default () => ({
729
738
}
730
739
731
740
shownPoppers . push ( this )
741
+ document . body . classList . add ( 'v-popper--some-open' )
742
+ for ( const theme of getAllParentThemes ( this . theme ) ) {
743
+ getShownPoppersByTheme ( theme ) . push ( this )
744
+ document . body . classList . add ( `v-popper--some-open--${ theme } ` )
745
+ }
732
746
733
747
this . $emit ( 'apply-show' )
734
748
@@ -758,6 +772,16 @@ export default () => ({
758
772
759
773
this . skipTransition = skipTransition
760
774
removeFromArray ( shownPoppers , this )
775
+ if ( shownPoppers . length === 0 ) {
776
+ document . body . classList . remove ( 'v-popper--some-open' )
777
+ }
778
+ for ( const theme of getAllParentThemes ( this . theme ) ) {
779
+ const list = getShownPoppersByTheme ( theme )
780
+ removeFromArray ( list , this )
781
+ if ( list . length === 0 ) {
782
+ document . body . classList . remove ( `v-popper--some-open--${ theme } ` )
783
+ }
784
+ }
761
785
762
786
if ( hidingPopper === this ) {
763
787
hidingPopper = null
0 commit comments