Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Flavien's review
  • Loading branch information
oliviertassinari committed Feb 20, 2024
commit 4bc1b4bc211ad1305decc9e589cda4f91bd7839b
8 changes: 4 additions & 4 deletions docs/src/modules/utils/CodeCopy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,13 @@ export function CodeCopyProvider({ children }: CodeCopyProviderProps) {
return;
}

const copyBtn = rootNode.current.querySelector('.MuiCode-copy') as HTMLButtonElement | null;
const copyBtn = rootNode.current.querySelector('.MuiCode-copy') as HTMLButtonElement;
const initialEventAction = copyBtn!.getAttribute('data-ga-event-action');
// update the 'data-ga-event-action' on the button to track keyboard interaction
copyBtn!.dataset.gaEventAction =
copyBtn.dataset.gaEventAction =
initialEventAction?.replace('click', 'keyboard') || 'copy-keyboard';
copyBtn!.click(); // let the GA setup in GoogleAnalytics.js do the job
copyBtn!.dataset.gaEventAction = initialEventAction!; // reset the 'data-ga-event-action' back to initial
copyBtn.click(); // let the GA setup in GoogleAnalytics.js do the job
copyBtn.dataset.gaEventAction = initialEventAction!; // reset the 'data-ga-event-action' back to initial
});
}, []);
return (
Expand Down