accordproject / web-components

React Components for Accord Project
Apache License 2.0
117 stars 94 forks source link

Paragraphs above or below clause templates can't be deleted #325

Closed Michael-Grover closed 3 years ago

Michael-Grover commented 3 years ago

Bug Report 🐛

If you triple-click on a paragraph above or below a clause template to highlight that paragraph, and then press backspace, the paragraph will not be deleted.

https://www.loom.com/share/fcb7605ba7834373a9a35c03687f0ac4

Expected Behavior

When a paragraph is highlighted and backspace is pressed, the paragraph should be deleted.

Current Behavior

When a paragraph directly above or below a clause template is highlighted, and then backspace is pressed, the paragraph is not deleted.

Steps to Reproduce

  1. Go to the contract editor storybook https://ap-web-components.netlify.app/?path=/story/contract-editor--contract-editor
  2. Triple click the paragraph below the clause template to highlight the entire paragraph
  3. Press backspace
  4. See the paragraph hasn't been deleted

Context (Environment)

Macbook Pro, Google Chrome

K-Kumar-01 commented 3 years ago

@Michael-Grover A thing to notice here. Selecting the entire paragraph by triple-clicking and pressing backspace doesn't delete the paragraph. However, selecting it manually and then pressing the backspace button deletes the paragraph.

Michael-Grover commented 3 years ago

@K-Kumar-01 yeah, my theory is that triple clicking to select the entire paragraph selects a small bit of the smart clause, which prevents the selection from being deleted.

irmerk commented 3 years ago

I'd hesitate trying to solve this. I think this is due to a standard feature of text editors being triple click selects all of a paragraph and a bit more. The bit more is what we prevent being deleted before and after a clause template.

The solution would likely be to change triple click behavior in our editor, which I don't think is a good idea.