Skip to content

Commit f78bdb3

Browse files
schmijostcbegley
andauthored
Forward undefined to target props instead of bool (#878)
* Forward undefined to target props instead of bool _react-dom_ complains with a warning if it receives booleans for non-boolean DOM properties (see <https://github.com/facebook/react/blob/main/packages/react-dom/src/shared/ReactDOMUnknownPropertyHook.js#L186-L190>). This passes `undefined` to the `target` props instead of `false to fix the warning. * Update src/components/dropdownmenu/DropdownMenuItem.js Co-authored-by: Tom Begley <[email protected]>
1 parent 9716b70 commit f78bdb3

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/components/dropdownmenu/DropdownMenuItem.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,9 @@ const DropdownMenuItem = props => {
5252
return (
5353
<RBDropdown.Item
5454
as={useLink ? Link : 'button'}
55-
// don't pass href if disabled otherwise reactstrap renders item
56-
// as link and the cursor becomes a pointer on hover
57-
href={disabled ? null : href}
55+
href={useLink ? href : undefined}
5856
disabled={disabled}
59-
target={useLink && target}
57+
target={useLink ? target : undefined}
6058
className={class_name || className}
6159
{...omit(['setProps'], otherProps)}
6260
data-dash-is-loading={

src/components/listgroup/ListGroupItem.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const ListGroupItem = props => {
1212
let {
1313
children,
1414
disabled,
15+
href,
1516
loading_state,
1617
target,
1718
n_clicks,
@@ -32,13 +33,14 @@ const ListGroupItem = props => {
3233
}
3334
};
3435
const isBootstrapColor = bootstrapColors.has(color);
35-
const useLink = props.href && !disabled;
36+
const useLink = href && !disabled;
3637
otherProps[useLink ? 'preOnClick' : 'onClick'] = incrementClicks;
3738

3839
return (
3940
<RBListGroupItem
4041
as={useLink ? Link : 'li'}
41-
target={useLink && target}
42+
href={href}
43+
target={useLink ? target : undefined}
4244
disabled={disabled}
4345
variant={isBootstrapColor ? color : null}
4446
style={!isBootstrapColor ? {backgroundColor: color, ...style} : style}

0 commit comments

Comments
 (0)