File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -44,17 +44,22 @@ const Button = props => {
44
44
const useLink = href && ! disabled ;
45
45
otherProps [ useLink ? 'preOnClick' : 'onClick' ] = onClick || incrementClicks ;
46
46
47
+ if ( useLink ) {
48
+ // react-bootstrap strips out target prop if tag isn't an anchor element,
49
+ // so we pass it through under a different name
50
+ otherProps [ 'linkTarget' ] = target ;
51
+ }
52
+
47
53
return (
48
54
< RBButton
49
55
as = { useLink ? Link : 'button' }
50
56
variant = { outline ? `outline-${ color } ` : color }
51
- type = { useLink ? null : type }
52
- target = { useLink ? target : null }
53
- href = { disabled ? null : href }
57
+ type = { useLink ? undefined : type }
58
+ href = { disabled ? undefined : href }
54
59
disabled = { disabled }
55
- download = { useLink ? download : null }
56
- name = { useLink ? null : name }
57
- value = { useLink ? null : value }
60
+ download = { useLink ? download : undefined }
61
+ name = { useLink ? undefined : name }
62
+ value = { useLink ? undefined : value }
58
63
className = { class_name || className }
59
64
{ ...omit ( [ 'n_clicks_timestamp' ] , otherProps ) }
60
65
data-dash-is-loading = {
Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ class Link extends Component {
67
67
external_link,
68
68
preOnClick,
69
69
target,
70
+ linkTarget,
70
71
href,
71
72
download,
72
73
...otherProps
@@ -80,8 +81,8 @@ class Link extends Component {
80
81
return (
81
82
< a
82
83
href = { href }
83
- target = { linkIsExternal ? target : null }
84
- download = { download && linkIsExternal ? download : null }
84
+ target = { linkIsExternal ? target || linkTarget : undefined }
85
+ download = { download && linkIsExternal ? download : undefined }
85
86
{ ...otherProps }
86
87
onClick = { e => this . updateLocation ( e ) }
87
88
>
You can’t perform that action at this time.
0 commit comments