Skip to content

Commit 2d737dc

Browse files
committed
remove unnecessary nesting
1 parent c5ae0ff commit 2d737dc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/react-core/src/components/Dropdown/examples/DropdownWithSplit.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ export const DropdownSplitButtonText: React.FunctionComponent = () => {
1414
const toggleRef = React.useRef<MenuToggleElement>(null);
1515

1616
const onFocus = () => {
17-
if (toggleRef.current) {
18-
const toggleButton = toggleRef.current.querySelector('button[aria-expanded]');
19-
if (toggleButton) {
20-
(toggleButton as HTMLElement).focus();
21-
}
17+
if (!toggleRef.current) {
18+
return;
2219
}
20+
21+
const toggleButton = toggleRef.current.querySelector('button[aria-expanded]');
22+
toggleButton?.focus();
2323
};
2424

2525
const onSelect = () => {

0 commit comments

Comments
 (0)