imglab icon indicating copy to clipboard operation
imglab copied to clipboard

Delete key not working on Mac

Open mohanpb opened this issue 5 years ago • 13 comments

Describe the bug I am not able to delete a wrong annotation in Mac using Chrome.

To Reproduce Steps to reproduce the behavior:

  1. Go to imglab.ml/#. Open an image
  2. Click on Polygon. Try to make an annotation. And then try to delete it.
  3. It fails

Screenshots

Even after pressing delete key multiple times, it is not working.

Console Errors

None

Device detail (please complete the following information):

  • OS: [e.g. Ubuntu] Mac
  • Browser [e.g. chrome, firefox] Chrome

Additional context

Watch for changes, or Bookmark for easy discovery. Fund this project for new features and maintenance. [Showcase] your project with us by raising an issue


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

mohanpb avatar Apr 26 '19 07:04 mohanpb

Thanks for reporting the issue. Unfortunately, I don't have mac to test it so this fix may take time. However, if you're a developer I'll appreciate if you can debug and fix the issue.

In addition of this, can you please share the console logs? It may help us to fix the issue without having mac.

amitguptagwl avatar Apr 28 '19 08:04 amitguptagwl

There are two issues.

  1. The Mac does NOT have an alt-key. (It has an "option" key in which some applications sometimes treat as an alt key. However, IMHO, it's better to allow the user to generate non-ascii characters.) . This means that there is no Alt-A to do the select-all command on the Mac. (I didn't bother fixing the other Alt-key short cuts.)

  2. The key that is labeled "delete" on the Mac generates a backspace.

These two fixes can be applied to the file workarea.tag.html which fixes the problem for me.

change line 31: if ( (e.keyCode == 46) || (e.keyCode == 8) ) {// del key is 46, backspace key is 8 (for Mac)

change line 54 (adds Ctl-A as a synonym for Alt-A) } else if ( (e.key === 'a' && e.altKey) || (e.key === 'a' && e.ctrlKey) ) {//TODO change this

gitclem avatar May 07 '19 19:05 gitclem

Ctrl key is used by browser for most of the operations and Alt key is used for some of the operations like opening the menu, access plugins etc. Hence, we'll have to write some modules which effectively manages keys across browsers and devices.

amitguptagwl avatar May 08 '19 00:05 amitguptagwl

I found this library, which seems like it will solve the various OS keyboard compatibility issues: https://wangchujiang.com/hotkeys/

gitclem avatar May 24 '19 17:05 gitclem

Thanks it'll be helpful.

amitguptagwl avatar May 30 '19 01:05 amitguptagwl

i have solved the issue tell me if is good solution for your program #152

leonardopalma avatar Jun 07 '19 15:06 leonardopalma

I'm thinking to use the 3rd party lib suggested by @gitclem . Otherwise we'll have to keep patching our code.

amitguptagwl avatar Jun 08 '19 06:06 amitguptagwl

I don't have knowledge about Mac, but if Del. key not working and there is no other alternatives so may be browser have something to del. that thing i am not sure, because i really don't have any knowledge about these type of bugs.

hitesh-19 avatar Jul 06 '19 17:07 hitesh-19

fn + delete worked for me

Zeeshan75 avatar Nov 07 '19 12:11 Zeeshan75

f+delete is the normal way to do a forward delete on the Mac. The "delete" key does backward delete

crayne avatar Aug 01 '20 18:08 crayne

Is this issue still open? If yes, Can you please brief me about it?

imrahul361 avatar Oct 03 '20 18:10 imrahul361

Is this issue still open? If yes, Can you please brief me about it?

I don't know. I'm no longer employed at the job where I encountered this. So, I haven't used this code in months.

My understanding is the problem is the Mac control/option/command keys work differently from windows control keys (which may be yet different again from Linux) within JavaScript.

I think there needs to be a conditional to check which OS is running, then interpret the keys appropriately. I was a bit of a newbie with git at the time, but now I realize I should have made a Pull Request once I had figured out how to fix the problem...

gitclem avatar Oct 03 '20 22:10 gitclem

Still open. Keyboards without forward delete key need to do something like fn+delete.

mmoollllee avatar Aug 08 '23 12:08 mmoollllee