Skip to content
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

Merged
merged 7 commits into from
Jan 6, 2021
Merged

Conversation

1ec5
Copy link
Collaborator

@1ec5 1ec5 commented Dec 22, 2020

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:

crosswalk

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.

@1ec5 1ec5 added accessibility Relates to personal ability or assistive tools keyboard An issue with keyboard navigation, shortcuts, or input labels Dec 22, 2020
@@ -158,6 +158,10 @@
"shortcuts": ["}", "⇟"],
"text": "shortcuts.browsing.vertex_selected.last"
},
{
"shortcuts": ["<"],
Copy link
Collaborator Author

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.

Copy link
Collaborator Author

@1ec5 1ec5 Dec 22, 2020

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.

Copy link
Collaborator Author

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.

@quincylvania quincylvania merged commit 872d820 into develop Jan 6, 2021
@quincylvania quincylvania deleted the 1ec5-select-way-2225 branch January 6, 2021 16:04
@quincylvania quincylvania added this to the 2.20.0 milestone Jan 6, 2021
quincylvania added a commit that referenced this pull request Jan 6, 2021
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
@quincylvania
Copy link
Collaborator

@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:

  • The ⌘↑ shortcut sounds fine on paper, but in practice I find it cramped to do with one hand and too far from [, ], and \. My first idea is to use |, but I'm not sure if that makes sense for international keyboard layouts. Another idea is to just use Return, but this might cause unexpected issues.
  • We should also have a reverse shortcut to put the selection back on the vertex. This would be useful in case of accidental selection, or if you just want to inspect the way before doing something else.

quincylvania added a commit that referenced this pull request Jan 6, 2021
…w (re: #8264)

Support pressing vertical bar again to return to node selection
@quincylvania
Copy link
Collaborator

My first idea is to use |

I did this for now, let me know what you think. You can press it again to toggle back to the vertex selection.

@1ec5
Copy link
Collaborator Author

1ec5 commented Jan 6, 2021

The ⌘↑ shortcut sounds fine on paper, but in practice I find it cramped to do with one hand and too far from [, ], and \. My first idea is to use |, but I'm not sure if that makes sense for international keyboard layouts. Another idea is to just use Return, but this might cause unexpected issues.

| will definitely be problematic. I considered that before <, but there are a lot of keyboard layouts that completely omit that character. (I heard about it all the time from Vietnamese wiki contributors, because the MediaWiki wikitext syntax for internal links includes a |. We worked around it by placing a | button under the textbox.) The nice thing about the arrows is that we know they exist on every keyboard layout with the same number of keystrokes. If ⌘↑ is unergonomic on laptop keyboards, then we should continue hunting for more common punctuation or, failing that, choose a letter (even though letters are usually for editing operations). Or bind both ⌘↑ and | to the same operation.

We should also have a reverse shortcut to put the selection back on the vertex. This would be useful in case of accidental selection, or if you just want to inspect the way before doing something else.

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.

jleedev pushed a commit to jleedev/iD that referenced this pull request Jan 9, 2021
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
jleedev pushed a commit to jleedev/iD that referenced this pull request Jan 9, 2021
…w (re: openstreetmap#8264)

Support pressing vertical bar again to return to node selection
@1ec5
Copy link
Collaborator Author

1ec5 commented Jan 13, 2021

#8298 continues the discussion about a key binding for this operation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility Relates to personal ability or assistive tools keyboard An issue with keyboard navigation, shortcuts, or input
Projects
None yet
2 participants