Web-stories-wp: Delete key sometimes does not delete elements

Created on 9 Mar 2020  路  3Comments  路  Source: google/web-stories-wp

Bug Description

Sometimes when elements are inserted/added, the user currently has to unselect them and re-select them for the delete to trigger

Expected Behaviour

Backspace key should delete the element whenever the element is in focus

Steps to Reproduce

Insert an element from the media library and attempt to delete it (doesn't work), unfocus/re-focus and try deleting again (works).

Accessibility Editing Bug

All 3 comments

We currently use useKeyDownEffect() for delete inside useCanvasKeys. That means it only works when within the canvas.

Compare this to undo/redo, for which we use useGlobalKeyDownEffect, which would make it work every time.

So we could use useGlobalKeyDownEffect for delete as well.

It works @swissspidy. Anyway, doing some side effects investigation on that useCanvasKeys hook, I noticed some problems on the rest of the keyboard controls configured there. So I am not sure if useGlobalKeyDownEffect would fix all these side effects since some are used in other parts of the plugin (e.g. esc, left, right). Is there some alternative path or concern about potential conflicts in this case? Also, should we consider these new cases on this issue?

FYI, these are the additional controls on the useCanvasKeys hook with the problem reported on this issue:

I will be also checking if we can still use useKeyDownEffect fixing the origin of the problem.

We could consider pushing it up the stack. I initially picked a narrower scope to start with. But if there's a reason to move it deeper, we definitely should.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

netnaps picture netnaps  路  3Comments

o-fernandez picture o-fernandez  路  3Comments

swissspidy picture swissspidy  路  4Comments

swissspidy picture swissspidy  路  3Comments

3pgarro picture 3pgarro  路  4Comments