Resolve "Backspace and Delete keys stop working after selecting specific types of cells"
requested to merge 1085-backspace-and-delete-keys-stop-working-after-selecting-specific-types-of-cells into develop
Merge Request Checklist
-
changelog.md has been updated if required
Describe the problem
Select a lookup field cell and/or a text formula cell and then try to edit any input box in Baserow and press delete. You'll notice it has stopped working. This is because for some components we have accidentally imported the gridField.js
mixin twice, causing two of the same keyDown
event handler to be registered on a element. The second one overwriting the first meaning it is never removed when the cell is deselected.
Potential fixes
Theres a number of things we can do:
- Defend against multiple mixins somehow, could somehow detect this in the mixin itself
- These event handlers never check the target of the event, they probably should (this partcilular keyDown one wants to only listen for keyDown events on the body but never actually checks the target to ensure this before preventDefaulting)
- Find a better way of persisting / overwriting eventHandlers. I believe the key problem here is that one mixin was overwriting the this.$el.keyDown property set by other
Also just not mixing this in twice in GridViewFieldFormula.vue
.
Chosen Fix
In this MR i've just mixed this in once. But i am sure there will be other bugs exactly due to this overriding event listener problem, i'll raise a new issue after the release to fix this properly.
Closes #1085 (closed)
Edited by Nigel Gott