Skip to content

Commit

Permalink
Fixed #7362 - TreeSelect errors on render in storybook due to treeRef…
Browse files Browse the repository at this point in the history
….current being null
  • Loading branch information
mertsincan committed Oct 21, 2024
1 parent d9e35ad commit c31fd7d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion components/lib/treeselect/TreeSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ export const TreeSelect = React.memo(
};

const setFocusToFocusableFirstNode = () => {
const treeNodeEl = DomHandler.find(treeRef.current.getElement(), '[data-pc-section="node"]');
const treeNodeEl = DomHandler.find(treeRef.current?.getElement(), '[data-pc-section="node"]');
const focusedElement = [...treeNodeEl].find((item) => item.getAttribute('tabindex') === '0');

DomHandler.focus(focusedElement);
Expand Down

0 comments on commit c31fd7d

Please sign in to comment.