Skip to content

Commit 2e1c194

Browse files
committed
fix: Tooltip containing disabled button does not show #73
1 parent 2d23f27 commit 2e1c194

File tree

3 files changed

+35
-12
lines changed

3 files changed

+35
-12
lines changed

components/button/style/index.less

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
@btn-prefix-cls: ~"@{ant-prefix}-btn";
66

7-
// for compatibile
7+
// for compatible
88
@btn-ghost-color: @text-color;
99
@btn-ghost-bg: transparent;
1010
@btn-ghost-border: @border-color-base;

components/button/style/mixin.less

+31-10
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@
109109
.button-group-base(@btnClassName) {
110110
position: relative;
111111
display: inline-block;
112-
> .@{btnClassName} {
112+
> .@{btnClassName},
113+
> span > .@{btnClassName} {
113114
position: relative;
114115
line-height: @btn-height-base - 2px;
115116

@@ -126,13 +127,15 @@
126127
}
127128

128129
// size
129-
&-lg > .@{btnClassName} {
130-
.button-size(@btn-height-lg; @btn-padding-lg; @btn-font-size-lg; @btn-border-radius-base);
130+
&-lg > .@{btnClassName},
131+
&-lg > span > .@{btnClassName} {
132+
.button-size(@btn-height-lg; @btn-padding-lg; @btn-font-size-lg; 0);
131133
line-height: @btn-height-lg - 2px;
132134
}
133135

134-
&-sm > .@{btnClassName} {
135-
.button-size(@btn-height-sm; @btn-padding-sm; @font-size-base; @btn-border-radius-sm);
136+
&-sm > .@{btnClassName},
137+
&-sm > span > .@{btnClassName} {
138+
.button-size(@btn-height-sm; @btn-padding-sm; @font-size-base; 0);
136139
line-height: @btn-height-sm - 2px;
137140
> .@{iconfont-css-prefix} {
138141
font-size: @font-size-base;
@@ -250,12 +253,17 @@
250253
.@{btnClassName} + &,
251254
span + .@{btnClassName},
252255
.@{btnClassName} + span,
256+
> span + span,
253257
& + .@{btnClassName},
254258
& + & {
255259
margin-left: -1px;
256260
}
257261

258-
.@{btnClassName}:not(:first-child):not(:last-child) {
262+
.@{btnClassName}-primary + .@{btnClassName}:not(.@{btnClassName}-primary):not([disabled]) {
263+
border-left-color: transparent;
264+
}
265+
266+
.@{btnClassName} {
259267
border-radius: 0;
260268
}
261269

@@ -266,14 +274,27 @@
266274

267275
> .@{btnClassName}:first-child:not(:last-child),
268276
> span:first-child:not(:last-child) > .@{btnClassName} {
269-
border-bottom-right-radius: 0;
270-
border-top-right-radius: 0;
277+
border-bottom-left-radius: @btn-border-radius-base;
278+
border-top-left-radius: @btn-border-radius-base;
271279
}
272280

273281
> .@{btnClassName}:last-child:not(:first-child),
274282
> span:last-child:not(:first-child) > .@{btnClassName} {
275-
border-bottom-left-radius: 0;
276-
border-top-left-radius: 0;
283+
border-bottom-right-radius: @btn-border-radius-base;
284+
border-top-right-radius: @btn-border-radius-base;
285+
}
286+
287+
&-sm {
288+
> .@{btnClassName}:first-child:not(:last-child),
289+
> span:first-child:not(:last-child) > .@{btnClassName} {
290+
border-bottom-left-radius: @btn-border-radius-sm;
291+
border-top-left-radius: @btn-border-radius-sm;
292+
}
293+
> .@{btnClassName}:last-child:not(:first-child),
294+
> span:last-child:not(:first-child) > .@{btnClassName} {
295+
border-bottom-right-radius: @btn-border-radius-sm;
296+
border-top-right-radius: @btn-border-radius-sm;
297+
}
277298
}
278299

279300
& > & {

components/tooltip/Tooltip.jsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ export default {
7777
// https://github.com/react-component/tooltip/issues/18
7878
getDisabledCompatibleChildren (ele) {
7979
const isAntBtn = ele.componentOptions && ele.componentOptions.Ctor.options.__ANT_BUTTON
80-
if (((isAntBtn && ele.componentOptions.propsData.disabled) || (ele.tag === 'button' && ele.data && ele.data.attrs.disabled !== false)) && this.isHoverTrigger()) {
80+
if (((isAntBtn && (ele.componentOptions.propsData.disabled || ele.componentOptions.propsData.disabled === '')) ||
81+
(ele.tag === 'button' && ele.data && ele.data.attrs.disabled !== false)) &&
82+
this.isHoverTrigger()) {
8183
// Pick some layout related style properties up to span
8284
// Prevent layout bugs like https://github.com/ant-design/ant-design/issues/5254
8385
const { picked, omited } = splitObject(

0 commit comments

Comments
 (0)