Skip to content

Commit

Permalink
Update .storybook/components/ElementNamer.jsx
Browse files Browse the repository at this point in the history
Co-authored-by: Gavin Barron <[email protected]>
  • Loading branch information
Mnickii and gavinbarron authored Jul 20, 2023
1 parent ecc76d8 commit 49e4fef
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .storybook/components/ElementNamer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const TableNamer = ({ names }) => {

export const CopyButtonNamer = ({ names }) => {
useEffect(() => {
window.addEventListener('load', () => {
const onWindowLoadHander = () => {
const buttons = document.getElementsByClassName('css-3ltsna');
if (buttons.length !== names.length) {
console.error(
Expand All @@ -30,6 +30,8 @@ export const CopyButtonNamer = ({ names }) => {
buttons[i].setAttribute('aria-label', names[i]);
}
});
window.addEventListener('load', onWindowLoadHander);
return () => window.removeEventListener('load', onWindowLoadHander);
}, [names]);
return <></>;
};

0 comments on commit 49e4fef

Please sign in to comment.