-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add shortcut to select parent way(s) #8264
Conversation
data/shortcuts.json
Outdated
@@ -158,6 +158,10 @@ | |||
"shortcuts": ["}", "⇟"], | |||
"text": "shortcuts.browsing.vertex_selected.last" | |||
}, | |||
{ | |||
"shortcuts": ["<"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Repeating this comment in a thread so it’s easier to discuss.)
I couldn’t think of an intuitive keyboard shortcut that was as convenient as the [ and ] shortcuts that it would complement. So I went with <, based on (of all things) the <
operator in OverpassQL, which recurses up to the parent of a node or way. I’m open to other ideas.
< is a common character on keyboard layouts due to its prevalence in basic math. Just to be on the safe side, I consulted Apple’s visual guide to physical keyboard localizations and checked each of the 169 keyboard layouts available on macOS:
- Hindi Devanagari, Khmer, Myanmar, Sinhala, and Tibetan Wylie lack a < key, though I didn’t check whether there are any dead keys that provide access to this character.
- Chinese Pinyin, Chinese Shuangpin, and Thai lack a < key, but Thai keyboards have a <-labeled key, so I suspect the expectation is that users would switch to a QWERTY keyboard when necessary.
To accommodate these keyboard layouts, we could make the keyboard shortcut localizable, relying on an assumption that keyboard layouts generally correspond to languages. If we choose a letter as the keyboard shortcut instead, then it would definitely have to be localizable.
All the other keyboard layouts have a < key, but some require pressing both Shift and AltGr at the same time, which can be inconvenient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I originally went with punctuation because it seems like iD generally reserves letters for editing operations and uses control keys or punctuation for navigation, which makes sense. The problem is that there are very few control keys left that aren’t used by iD or the browser, and very few punctuation characters are universal among keyboard layouts.
An alternative I didn’t consider earlier was Ctrl↑ on Windows or ⌘↑ on macOS. These keys are physical keys on every keyboard, regardless of locale.
This combination is unlikely to cause a conflict with browsers. On Windows, Ctrl↑ would move the caret to the beginning of the paragraph, but this shortcut would take effect when no text field has focus. On macOS, ⌘↑ would move the caret to the beginning of a text field or scroll to the top of the page, but iD doesn’t scroll like a page (cue request to jump to the North Pole). It’s also Finder’s shortcut for moving up to the containing folder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but iD doesn’t scroll like a page
If the focus is somehow on the sidebar (but not one of its fields), then pressing ⌘↓ jumps to the bottom of the scroll view but ⌘↑ would select the parent ways instead of jumping to the top of the scroll view. I think this situation would be relatively rare, but hopefully there’s a way to special-case the shortcut to only occur when the canvas has focus. Otherwise, that would be a good argument for making the shortcut CtrlShift↑ on Windows and ⇧⌘↑ on macOS.
3e84a93
to
8e2301d
Compare
Fix stale highlight-focus of parent way when selecting an unrelated vertex Rename some confusing identifiers in modeSelect Move global _relatedParent functionality into modeSelect proper Re: #8264
@1ec5 Thanks for this! I hadn't much used iD's vertex navigation keys before, but they're definitely an underrated accessibility feature. It's great to fill in this missing action. Some thoughts:
|
…w (re: #8264) Support pressing vertical bar again to return to node selection
I did this for now, let me know what you think. You can press it again to toggle back to the vertex selection. |
| will definitely be problematic. I considered that before
Yes, this is why I tried to find a key that has a companion key we could use for the reverse operation. If ⌘↑ goes “up” to the way, then ⌘↓ can go back down to the vertices (or just the previously selected vertex if known). Another possibility in the future could be to select parent relations using ⌘↑ or relation members using ⌘↓, for completeness. |
Fix stale highlight-focus of parent way when selecting an unrelated vertex Rename some confusing identifiers in modeSelect Move global _relatedParent functionality into modeSelect proper Re: openstreetmap#8264
…w (re: openstreetmap#8264) Support pressing vertical bar again to return to node selection
#8298 continues the discussion about a key binding for this operation. |
Pressing Ctrl↑ on Windows or ⌘↑ on macOS selects the selected node’s highlighted parent way, or all the node’s parent ways if none is currently highlighted.
Rationale
This keyboard shortcut is helpful for keyboard accessibility, reducing the need to use the mouse in some cases. For example, in this scenario, the crosswalk way’s hit target is crowded out by the crosswalk node’s icon and adjacent road and sidewalk ways:
Without this keyboard shortcut, you would have to switch to wireframe mode, zoom in, or meticulously move the mouse until the cursor changes to indicate a line selection. These workarounds would be inconvenient for users who prefer to stay at a single zoom level while mapping without switching modes.
The lasso selection tool (Shift-drag) only selects nodes, which is adequate if you want to delete or move entire lines or areas. If you want to change tags on multiple lines or areas, then you can use this keyboard shortcut after making a lasso selection.
The keyboard shortcut is especially helpful when multiple ways (lines or areas) are joined at multiple consecutive nodes, such as a power substation that shares its nodes with the fence that surrounds it, or an office building with multiple tenants occupying entire floors. Without this shortcut, users have to try their luck selecting the joined lines or areas, often having to resort to complicated workarounds like creating temporary nodes, disconnecting them, and deleting them one by one.
iD has long had a \ shortcut (also Pause on Windows) that works like Potlatch’s / to cycle among the ways that are joined at the selected node, but until now, it hasn’t had anything like Potlatch’s W shortcut to select the highlighted way. Potlatch is about to disappear from the Web, so it feels like an appropriate time to bring this feature to iD for safekeeping. (JOSM’s UtilsPlugin2 plugin has a similar command, Adjacent Ways.)
Examples
The following screen recordings depict three hypothetical but realistic examples:
If you select a shared node and press Ctrl↑ or ⌘↑, all the parent ways are selected:
all-parents.mov
Thanks to the multiselection support added in #1761, you can select the parent way you want from the Features list:
select.mov
If you select a shared node and highlight a specific parent way using \, then pressing Ctrl↑ or ⌘↑ causes only that highlighted way to be selected:
follow.mov
Intuitively, if you’re already following the nodes along a specific way (using the [ and ] shortcuts), then you’d want to select that way instead of having to choose it again from the Features list.
If you select multiple shared nodes, pressing ↑ or ⌘↑ selects all their parents, even if some of the nodes have different parents than others. In the scenario below, higher-resolution imagery shows that the rooftop solar panel doesn’t extend to the edges of the building, so you’d lasso-select all the nodes that make up the building, select the union of their parent ways, select the solar panel from the Features list, and use the Disconnect and Scale operations to refine the solar panel independently of the rest of the features:
disconnect.mov
Internationalization
iD seems to generally reserve letters for editing operations and uses control keys or punctuation for navigation, which makes sense. The problem is that there are very few control keys left that aren’t used by iD or the browser, and very few punctuation characters are universal among keyboard layouts. I went with Ctrl↑ on Windows and ⌘↑ on macOS because these are physical keys on every keyboard, regardless of locale.
This combination is unlikely to cause a conflict with browsers. On Windows, Ctrl↑ would move the caret to the beginning of the paragraph, but this shortcut would take effect when no text field has focus. On macOS, ⌘↑ would move the caret to the beginning of a text field or scroll to the top of the page, but iD doesn’t scroll like a page (cue request to jump to the North Pole). It’s also Finder’s shortcut for moving up to the containing folder.
Other caveats
I’m unsure of a good way to expose this functionality to touchscreens. From #7590, it looks like iD does support multiple selection on touch screens, but I’m unsure about [ and ] navigation. Maybe we could add a context menu item that corresponds to the “Select parent way” command?
Fixes #1239, fixes #2225, fixes #5009, and fixes #7375.