File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
client/components/PDropdown Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import clsx from 'clsx'
1818
1919class PDropDown extends React . Component {
2020 dropRef = createRef ( )
21+ pTriggerRef = null
2122
2223 constructor ( props ) {
2324 super ( props )
@@ -28,7 +29,7 @@ class PDropDown extends React.Component {
2829
2930 hideDropdownOnMouseUp ( e ) {
3031 if ( this . dropRef . current ) {
31- if ( ! this . dropRef . current . contains ( e . target ) ) {
32+ if ( ! this . dropRef . current . contains ( e . target ) && ! this . pTriggerRef . contains ( e . target ) ) {
3233 document . removeEventListener ( 'mouseup' , this . hideDropdownOnMouseUp )
3334 this . dropRef . current . classList . remove ( 'pDropOpen' )
3435 }
@@ -48,6 +49,8 @@ class PDropDown extends React.Component {
4849 return true
4950 }
5051
52+ this . pTriggerRef = pTrigger
53+
5154 if ( this . dropRef . current ) {
5255 const ref = this . dropRef . current
5356 if ( ref . classList . contains ( 'pDropOpen' ) ) {
Original file line number Diff line number Diff line change @@ -1172,11 +1172,9 @@ define([
11721172 }
11731173
11741174 helpers . hideAllpDropDowns = function ( ) {
1175- $ ( '[data-notifications]' ) . each ( function ( ) {
1176- var drop = $ ( '#' + $ ( this ) . attr ( 'data-notifications' ) )
1177- if ( drop . hasClass ( 'pDropOpen' ) ) {
1178- drop . removeClass ( 'pDropOpen' )
1179- }
1175+ $ ( '.p-dropdown' ) . each ( function ( ) {
1176+ const $drop = $ ( this )
1177+ if ( $drop . hasClass ( 'pDropOpen' ) ) $drop . removeClass ( 'pDropOpen' )
11801178 } )
11811179 }
11821180
You can’t perform that action at this time.
0 commit comments