@@ -68,6 +68,38 @@ const CompositeBarView: FC<CompositeBarViewProps> = ({
68
68
} = useContext ( MultipleTooltipContext ) ;
69
69
const { compact} = useAsideHeaderContext ( ) ;
70
70
71
+ const handleTransitionRun = React . useCallback < ( e : TransitionEvent ) => void > (
72
+ ( e ) => {
73
+ if ( e . target ) {
74
+ const computedStyle = getComputedStyle ( e . target as HTMLElement ) ;
75
+ const isHovered = computedStyle . transform !== 'none' ;
76
+ console . log ( 'isHovered=' , isHovered , new Date ( ) ) ;
77
+ if ( ! isHovered && multipleTooltip && multipleTooltipActive ) {
78
+ setMultipleTooltipContextValue ( { active : false } ) ;
79
+ }
80
+ }
81
+ } ,
82
+ [ multipleTooltip , multipleTooltipActive ] ,
83
+ ) ;
84
+
85
+ React . useEffect ( ( ) => {
86
+ if ( ref . current ?. refContainer . current ?. node ) {
87
+ const listNode = ref . current . refContainer . current . node as HTMLElement ;
88
+ // this hack allow to detect hover events on element like browser css engine
89
+ listNode . style . setProperty ( 'transition' , 'transform 0.001ms step-start' ) ;
90
+ listNode . style . setProperty ( 'transition-behavior' , 'allow-discrete' ) ;
91
+ listNode . addEventListener ( 'transitionrun' , handleTransitionRun ) ;
92
+
93
+ return ( ) => {
94
+ listNode . removeEventListener ( 'transitionrun' , handleTransitionRun ) ;
95
+ listNode . style . removeProperty ( 'transition-behavior' ) ;
96
+ listNode . style . removeProperty ( 'transition' ) ;
97
+ } ;
98
+ }
99
+
100
+ return ;
101
+ } , [ ] ) ;
102
+
71
103
React . useEffect ( ( ) => {
72
104
function handleBlurWindow ( ) {
73
105
if ( multipleTooltip && multipleTooltipActive ) {
@@ -93,7 +125,6 @@ const CompositeBarView: FC<CompositeBarViewProps> = ({
93
125
activeIndex !== lastClickedItemIndex &&
94
126
e . clientX <= ASIDE_HEADER_COMPACT_WIDTH
95
127
) {
96
- console . log ( `onTooltipMouseEnter: active=true` ) ;
97
128
setMultipleTooltipContextValue ?.( {
98
129
active : true ,
99
130
} ) ;
@@ -119,7 +150,6 @@ const CompositeBarView: FC<CompositeBarViewProps> = ({
119
150
debounce (
120
151
( ) => {
121
152
if ( multipleTooltip && multipleTooltipActive && document . hasFocus ( ) ) {
122
- console . log ( `onTooltipMouseLeave: active=false` ) ;
123
153
setMultipleTooltipContextValue ?.( {
124
154
active : false ,
125
155
lastClickedItemIndex : undefined ,
@@ -139,7 +169,6 @@ const CompositeBarView: FC<CompositeBarViewProps> = ({
139
169
( itemIndex : number ) =>
140
170
debounce (
141
171
( ) => {
142
- console . log ( `onMouseEnterByIndex: itemIndex=${ itemIndex } ` ) ;
143
172
if ( multipleTooltip && document . hasFocus ( ) ) {
144
173
let multipleTooltipActiveValue = multipleTooltipActive ;
145
174
if ( ! multipleTooltipActive && itemIndex !== lastClickedItemIndex ) {
@@ -149,10 +178,8 @@ const CompositeBarView: FC<CompositeBarViewProps> = ({
149
178
activeIndex === itemIndex &&
150
179
multipleTooltipActive === multipleTooltipActiveValue
151
180
) {
152
- console . log ( 'onMouseEnterByIndex: skip change' ) ;
153
181
return ;
154
182
}
155
- console . log ( `onMouseEnterByIndex: set active=${ itemIndex } ` ) ;
156
183
setMultipleTooltipContextValue ( {
157
184
activeIndex : itemIndex ,
158
185
active : multipleTooltipActiveValue ,
@@ -183,7 +210,6 @@ const CompositeBarView: FC<CompositeBarViewProps> = ({
183
210
multipleTooltip &&
184
211
( activeIndex !== undefined || lastClickedItemIndex !== undefined )
185
212
) {
186
- console . log ( 'onMouseLeave: deactivate tooltip' ) ;
187
213
setMultipleTooltipContextValue ( {
188
214
activeIndex : undefined ,
189
215
lastClickedItemIndex : undefined ,
@@ -239,6 +265,7 @@ const CompositeBarView: FC<CompositeBarViewProps> = ({
239
265
onMouseLeave = { onTooltipMouseLeave }
240
266
>
241
267
< List < CompositeBarItem >
268
+ className = { b ( 'list' ) }
242
269
ref = { ref }
243
270
items = { items }
244
271
selectedItemIndex = { type === 'menu' ? getSelectedItemIndex ( items ) : undefined }
@@ -249,7 +276,6 @@ const CompositeBarView: FC<CompositeBarViewProps> = ({
249
276
filterable = { false }
250
277
sortable = { false }
251
278
renderItem = { ( item , _isItemActive , itemIndex ) => {
252
- // console.log('renderItem: ', itemIndex);
253
279
const itemExtraProps = isMenuItem ( item ) ? { item} : item ;
254
280
const enableTooltip = isMenuItem ( item )
255
281
? ! multipleTooltip
0 commit comments