web-components
web-components copied to clipboard
Cannot delete a Clause with backspace
We currently prevent removing Clauses using the backspace key. This means that you cannot easily remove all of the contract text if the contract contains a clause.
To Reproduce
- Go to https://cicero-ui.netlify.com
- Press CTRL-A to select all the text in the editor
- Press backspace
- Nothing happens (NOK)
Expected behavior I think if that is the selection range completely encompasses a clause then backspace should remove it.
Desktop (please complete the following information):
- OS: Mac OS
- Browser Safari
- Version 13.1
@dselman, it seems to work when lockText
prop is set to false
. Please refer to the gif below.
Can we give the user that extends this component the option to choose between allowing clauses to be deleted by backspace, and not allowing clauses to be deleted by backspace? In some apps that extend this component, such as Clause.io, clauses can have many settings that can take a long time to configure. By allowing one stroke of backspace to delete an entire Clause, it could make it too easy to accidentally delete.
@Michael-Grover I agree with this part of yours.If the user accidentally does it then we can send a toast
notification to the user and if the user clicks ok then it will be deleted.
I think there will be quite a few considerations to be taken when deleting a clause. For instance, how the information will likely be passed to the Library component, or any other component being used upstream which relies on the data of the contract.
I don't think AP wants to be using toast for anything at this point.