ui: js: clipboard: refactor toggle to remove randomness

- makes the clipboard toggle work consistently
- fixes randomly failing test `features/batch_edit_permissions.feature`