I was inputting notes quickly and made a finger/key slip and hit another key. But the result gave me a grace note against my last note - which is great. However I dont know what I did. It is not in the usual page of shortcuts and cannot find a similar shortcut.
Is there any way to view the last 20, 30 or 40 keystrokes to see what I did?
You probably pressed / which is the default shortcut to add a grace note.
You can find a list of the default shortcuts here https://musescore.org/en/handbook/4/all-keyboard-shortcuts
You can see the current assignment of shortcuts in View>Preferences>Shortcuts and that list can be sorted and filtered.
There is no way that I know of to see the last keystrokes but CTRL+Z should undo them one by one.