openstreetmap / iD

🆔 The easy-to-use OpenStreetMap editor in JavaScript.
https://www.openstreetmap.org/edit?editor=id
ISC License
3.38k stars 1.21k forks source link

'Toggle history panel' keyboard shortcut overrides browser shortcuts on macOS #10479

Open gy-mate opened 1 month ago

gy-mate commented 1 month ago

URL

https://www.openstreetmap.org/edit

How to reproduce the issue?

  1. Open the URL
  2. Click somewhere on the map
  3. Press ⌘⇧H
  4. The iD History panel opens instead of...
    • the home page of the browser (Safari 18.0, Google Chrome 129.0.6668.71, Microsoft Edge 129.0.2792.65)
    • the History sidebar of the browser (Firefox 130.0.1)

https://github.com/user-attachments/assets/ea1a6073-dbb2-4722-92b2-2902e67b4b5f

Screenshot(s) or anything else?

The issue is present on macOS 15.0 using the browsers above. I haven't tested Opera and Vivaldi.

I think this is the relevant line in the code: https://github.com/openstreetmap/iD/blob/0ce8136279055311e2355c98b4dfab5a5f96a3a4/modules/ui/sections/data_layers.js#L404

Maybe it could be solved by requiring an additional press on the ⌥ key:

        var historyPanelLabelEnter = panelsListEnter
            .append('li')
            .attr('class', 'history-panel-toggle-item')
            .append('label')
            .call(uiTooltip()
                .title(() => t.append('map_data.history_panel.tooltip'))
-                .keys([uiCmd('⌘⇧' + t('info_panels.history.key'))])
+                .keys([uiCmd('⌘⌥⇧' + t('info_panels.history.key'))])
                .placement('top')
            );

To do after the issue is closed as completed

Which deployed environments do you see the issue in?

Released version at openstreetmap.org/edit, Development version at ideditor.netlify.app, RapiD version at mapwith.ai/rapid

What version numbers does this issue effect?

2.30.2

Which browsers are you seeing this problem on?

Chrome, Firefox, Microsoft Edge, Safari

1ec5 commented 1 month ago

I’m unable to reproduce this issue in Firefox 131 on macoS 14.7. However, I often find that the built-in shortcuts involving the command key trigger browser functions when the keyboard focus is either inside a text field or somewhere outside of iD. Do you know if this could’ve been the case for you when you encountered this issue?

gy-mate commented 1 month ago

I often find that the built-in shortcuts involving the command key trigger browser functions when the keyboard focus is either inside a text field or somewhere outside of iD. Do you know if this could’ve been the case for you when you encountered this issue?

@1ec5 The issue is that iD functions are triggered instead of browser functions, so I think this isn't the case.

I've updated the issue description with more version numbers and a screen recording.

1ec5 commented 1 month ago

Ah, I see what you mean. Almost any key combo involving Command is going to conflict with a browser or OS function, though adding Option makes it less likely. For some things like searching and saving, this is intentional, but for the History panel it can be surprising. Another example is command-B for switching backgrounds versus (in Firefox) toggling the Bookmarks sidebar.

If we add Option to the key combo, then we can remove the Shift key to preserve the ergonomics. We’d need to keep Command in there, because Option alone would conflict with some popular keyboard layouts.

gy-mate commented 1 month ago

Good idea!