iD icon indicating copy to clipboard operation
iD copied to clipboard

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

Open gy-mate opened this issue 1 year ago • 4 comments

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

  • [ ] Update the Wiki at https://wiki.openstreetmap.org/w/index.php?title=ID/Shortcuts&veaction=edit&section=8

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

gy-mate avatar Sep 28 '24 23:09 gy-mate

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?

1ec5 avatar Sep 29 '24 05:09 1ec5

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.

gy-mate avatar Sep 29 '24 12:09 gy-mate

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.

1ec5 avatar Sep 29 '24 14:09 1ec5

Good idea!

gy-mate avatar Sep 29 '24 14:09 gy-mate

As mentioned in https://github.com/openstreetmap/iD/pull/11392#issuecomment-3302964555: I'm having a bit of a hard time understanding the problem here: Yes, iD has some keyboard shortcuts that involve modifier keys like Ctrl. Yes, these can clash with the browser's built in functionality. But as iD is not meant to be used like a "regular" web page, but rather like an application inside the browser, I don't think this is necessarily a problem.

Under what circumstance does one need to access functions like opening of the browser's start page while mapping? Similarly, opening the bookmarks/history sidebar and other browser functionality is IMHO not critical while mapping.[^1] iD tries to not override the most important browser shortcuts like Ctrl W or Ctrl T[^3], but for anything that is more "obscure" in the context of a mapping session, I think it is fine for iD to take precedence.

In the mid term the best solution is probably to allow users to customize their keyboard shortcuts[^2] to free any special browser functionality they need. That will be possible to implement after #11239 is completed.

[^1]: PS: Any of the browser's keyboard shortcuts can always still be accessed by exiting the focus of the iD document by pressing Ctrl L, or alternatively by opening a new Tab an performing the respective shortcut there. [^2]: Interestingly, it seems like there is no feature request issue for that yet: I only found https://github.com/openstreetmap/iD/issues/7866#issuecomment-696324921 [^3]: Alt is already a relatively big exception here. 😅

tyrasd avatar Sep 17 '25 13:09 tyrasd

as iD is not meant to be used like a "regular" web page, but rather like an application inside the browser, I don't think this is necessarily a problem.

What difference does it make that iD is embedded in an <iframe> on http://openstreetmap.org/edit? (It's going to stay like this until #7639 is resolved.) A regular user doesn't really know or care about that, I think.

Under what circumstance does one need to access functions like opening of the browser's start page while mapping?

When I finish mapping I always open my home page to free up system resources. (I keep Safari open due to the pinned tabs.)

iD tries to not override the most important browser shortcuts like Ctrl W or Ctrl T, but for anything that is more "obscure" in the context of a mapping session, I think it is fine for iD to take precedence.

I don't think it's a good idea to override browser shortcuts (Safari uses these: https://support.apple.com/guide/safari/keyboard-and-other-shortcuts-cpsh003/mac). A new OSM editor is used to the browser's shortcuts, not iD's, so when they do not work, it might some as a (not-so-great) surprise.

In https://github.com/openstreetmap/iD/pull/11392#issuecomment-3302964555, you mentioned:

chaning the shortcut would likely break the habits of many users who memorized the shortcut to toggle the panels.

True, but is there any other reason to keep it this way? Because if not, I think we'd be better off with switching to shortcuts that do not collide with the browsers' as soon as possible (in order not to have more users getting used to these ones).

gy-mate avatar Sep 20 '25 21:09 gy-mate

Realistically I think we’re always going to interfere with something that happens in the browser or operating system. We have so many things that require key bindings that we can’t completely avoid Ctrl/command or Alt/option (critical for some non-English keyboard layouts) unless we combine modifiers. Adding more fingers makes the shortcuts less accessible, which makes iD less usable.

We can get away with this only to the extent that other Web applications get away with it. For example, when you use Google Docs or any rich text editor on a webpage, you expect CtrlB to boldface the selected text, not open bookmarks. You want Google Slides to have CtrlF search the spreadsheet’s content, not whatever text happens to be in view.

It’s a moving target: even though CtrlK is as important as CtrlL in some browsers, enough applications override it for a quick command search bar that some users have come to expect it: #8801.

1ec5 avatar Sep 21 '25 16:09 1ec5

When I finish mapping I always open my home page to free up system resources. (I keep Safari open due to the pinned tabs.)

I would have recommended to fully close the iD tab (Command-W) to free all associated resources, or is the iD tab one of your pinned tabs? 🤔

True, but is there any other reason to keep it this way?

Well, as we also want to keep the consistency between different related shortcuts in iD, we would have to change all 4 of the panel shortcuts accordingly. So the argument for keeping it weighs fourfold. Also, the shortcut for the history panel has been around for a long time (946432d6f1c17876a98d177a3668ea6e9d3ada88), and AFAICS your the first mapper to notice the clash.

I opened #11433 which is IMO the better approach to approach this issue in general.

tyrasd avatar Sep 22 '25 11:09 tyrasd

I would have recommended to fully close the iD tab (Command-W) to free all associated resources, or is the iD tab one of your pinned tabs? 🤔

I like to open my home page instead of a blank page, but I see that it's not a popular habit. :)

I opened #11433 which is IMO the better approach to approach this issue in general.

Thank you very much! :)

gy-mate avatar Sep 23 '25 18:09 gy-mate