@jetbrains/ring-ui 7.0.80 → 7.0.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -125,10 +125,12 @@ export default class Dropdown extends Component {
|
|
|
125
125
|
onContextMenu: hoverMode ? this.handlePopupInteraction : undefined,
|
|
126
126
|
dontCloseOnAnchorClick: true,
|
|
127
127
|
};
|
|
128
|
-
return (<div data-test={dataTests('ring-dropdown', dataTest)} {...restProps}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
128
|
+
return (<div data-test={dataTests('ring-dropdown', dataTest)} {...restProps} onMouseEnter={hoverMode ? this.onMouseEnter : undefined} onMouseLeave={hoverMode ? this.onMouseLeave : undefined} className={classes}>
|
|
129
|
+
{clickMode ? (<div data-test='ring-dropdown-anchor-click-interceptor' className={styles.clickInterceptor} onClick={this.onClick}
|
|
130
|
+
// anchorElement should be a `button` or an `a`
|
|
131
|
+
role='presentation'>
|
|
132
|
+
{anchorElement}
|
|
133
|
+
</div>) : (anchorElement)}
|
|
132
134
|
{typeof children === 'function'
|
|
133
135
|
? children(childProps)
|
|
134
136
|
: cloneElement(children, childProps)}
|
|
@@ -20,28 +20,6 @@ import { setCSSAnchorPositioning, supportsCSSAnchorPositioning } from './positio
|
|
|
20
20
|
import { ThemeContext, WithThemeClasses } from '../global/theme';
|
|
21
21
|
import styles from './popup.css';
|
|
22
22
|
export { PopupTargetContext, PopupTarget };
|
|
23
|
-
const isPossibleClientSideNavigation = (event) => {
|
|
24
|
-
const target = event.target;
|
|
25
|
-
const link = target.closest('a');
|
|
26
|
-
// Taken from https://github.com/nanostores/router/blob/80a333db4cf0789fda21a02715ebabca15192642/index.js#L58-L69
|
|
27
|
-
return (link &&
|
|
28
|
-
event.button === 0 && // Left mouse button
|
|
29
|
-
link.target !== '_blank' && // Not for new tab
|
|
30
|
-
link.origin === location.origin && // Not external link
|
|
31
|
-
link.rel !== 'external' && // Not external link
|
|
32
|
-
link.target !== '_self' && // Now manually disabled
|
|
33
|
-
!link.download && // Not download link
|
|
34
|
-
!event.altKey && // Not download link by user
|
|
35
|
-
!event.metaKey && // Not open in new tab by user
|
|
36
|
-
!event.ctrlKey && // Not open in new tab by user
|
|
37
|
-
!event.shiftKey && // Not open in new window by user
|
|
38
|
-
!event.defaultPrevented);
|
|
39
|
-
};
|
|
40
|
-
const stop = (event) => {
|
|
41
|
-
if (!isPossibleClientSideNavigation(event)) {
|
|
42
|
-
event.stopPropagation();
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
23
|
export const getPopupContainer = (target) => typeof target === 'string' ? document.querySelector(`[data-portaltarget=${target}]`) : target;
|
|
46
24
|
/**
|
|
47
25
|
* @constructor
|
|
@@ -315,11 +293,7 @@ export default class Popup extends PureComponent {
|
|
|
315
293
|
[styles.showing]: showing,
|
|
316
294
|
[styles.largeBorderRadius]: largeBorderRadius,
|
|
317
295
|
});
|
|
318
|
-
return (<span
|
|
319
|
-
// prevent bubbling through portal
|
|
320
|
-
onClick={stop}
|
|
321
|
-
// This handler only blocks bubbling through React portal
|
|
322
|
-
role='presentation' ref={this.portalRef}>
|
|
296
|
+
return (<span ref={this.portalRef}>
|
|
323
297
|
{this.shouldUseShortcuts() && <Shortcuts map={this.shortcutsMap} scope={this.shortcutsScope}/>}
|
|
324
298
|
|
|
325
299
|
{client !== false &&
|