It does work and carrys out its purpose but some browsers literally don't trigger the action such as chrome on mobile and if the action is being used, you can only backspace 1 character at a time so highlighting your entire code and then backspacing doesn't function as expected.
These might just be edge cases not worth worrying about as the user only interacts with the code input box briefly.